@performant-software/geospatial 2.2.21-beta.8 → 2.2.21
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/build/index.js +2 -0
- package/build/index.js.map +1 -0
- package/build/main.css +127 -0
- package/dist/index.cjs100.js +1 -1
- package/dist/index.cjs100.js.map +1 -1
- package/dist/index.cjs101.js +1 -1
- package/dist/index.cjs101.js.map +1 -1
- package/dist/index.cjs102.js +1 -1
- package/dist/index.cjs102.js.map +1 -1
- package/dist/index.cjs103.js +1 -1
- package/dist/index.cjs103.js.map +1 -1
- package/dist/index.cjs104.js +1 -1
- package/dist/index.cjs104.js.map +1 -1
- package/dist/index.cjs105.js +1 -1
- package/dist/index.cjs105.js.map +1 -1
- package/dist/index.cjs106.js +1 -1
- package/dist/index.cjs106.js.map +1 -1
- package/dist/index.cjs107.js +1 -1
- package/dist/index.cjs107.js.map +1 -1
- package/dist/index.cjs108.js +1 -1
- package/dist/index.cjs108.js.map +1 -1
- package/dist/index.cjs109.js +1 -1
- package/dist/index.cjs109.js.map +1 -1
- package/dist/index.cjs110.js +1 -1
- package/dist/index.cjs110.js.map +1 -1
- package/dist/index.cjs111.js +1 -1
- package/dist/index.cjs111.js.map +1 -1
- package/dist/index.cjs112.js +1 -1
- package/dist/index.cjs112.js.map +1 -1
- package/dist/index.cjs113.js +1 -1
- package/dist/index.cjs113.js.map +1 -1
- package/dist/index.cjs114.js +1 -1
- package/dist/index.cjs114.js.map +1 -1
- package/dist/index.cjs115.js +1 -1
- package/dist/index.cjs115.js.map +1 -1
- package/dist/index.cjs116.js +1 -1
- package/dist/index.cjs116.js.map +1 -1
- package/dist/index.cjs117.js +1 -1
- package/dist/index.cjs117.js.map +1 -1
- package/dist/index.cjs118.js +1 -1
- package/dist/index.cjs118.js.map +1 -1
- package/dist/index.cjs119.js +1 -1
- package/dist/index.cjs119.js.map +1 -1
- package/dist/index.cjs12.js +1 -1
- package/dist/index.cjs120.js +1 -1
- package/dist/index.cjs120.js.map +1 -1
- package/dist/index.cjs121.js +1 -1
- package/dist/index.cjs121.js.map +1 -1
- package/dist/index.cjs122.js +1 -1
- package/dist/index.cjs122.js.map +1 -1
- package/dist/index.cjs123.js +1 -1
- package/dist/index.cjs123.js.map +1 -1
- package/dist/index.cjs124.js +1 -1
- package/dist/index.cjs124.js.map +1 -1
- package/dist/index.cjs125.js +1 -13
- package/dist/index.cjs125.js.map +1 -1
- package/dist/index.cjs126.js +1 -1
- package/dist/index.cjs126.js.map +1 -1
- package/dist/index.cjs127.js +1 -1
- package/dist/index.cjs127.js.map +1 -1
- package/dist/index.cjs128.js +1 -1
- package/dist/index.cjs128.js.map +1 -1
- package/dist/index.cjs129.js +13 -1
- package/dist/index.cjs129.js.map +1 -1
- package/dist/index.cjs130.js +1 -1
- package/dist/index.cjs130.js.map +1 -1
- package/dist/index.cjs131.js +1 -1
- package/dist/index.cjs131.js.map +1 -1
- package/dist/index.cjs132.js +1 -1
- package/dist/index.cjs132.js.map +1 -1
- package/dist/index.cjs133.js +1 -1
- package/dist/index.cjs133.js.map +1 -1
- package/dist/index.cjs134.js +1 -1
- package/dist/index.cjs134.js.map +1 -1
- package/dist/index.cjs135.js +1 -1
- package/dist/index.cjs135.js.map +1 -1
- package/dist/index.cjs136.js +1 -1
- package/dist/index.cjs136.js.map +1 -1
- package/dist/index.cjs137.js +1 -1
- package/dist/index.cjs137.js.map +1 -1
- package/dist/index.cjs138.js +1 -1
- package/dist/index.cjs138.js.map +1 -1
- package/dist/index.cjs139.js +1 -1
- package/dist/index.cjs139.js.map +1 -1
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs140.js +1 -1
- package/dist/index.cjs140.js.map +1 -1
- package/dist/index.cjs141.js +1 -1
- package/dist/index.cjs141.js.map +1 -1
- package/dist/index.cjs142.js +1 -1
- package/dist/index.cjs142.js.map +1 -1
- package/dist/index.cjs143.js +1 -1
- package/dist/index.cjs143.js.map +1 -1
- package/dist/index.cjs144.js +1 -1
- package/dist/index.cjs144.js.map +1 -1
- package/dist/index.cjs145.js +1 -1
- package/dist/index.cjs145.js.map +1 -1
- package/dist/index.cjs146.js +1 -1
- package/dist/index.cjs146.js.map +1 -1
- package/dist/index.cjs147.js +1 -1
- package/dist/index.cjs147.js.map +1 -1
- package/dist/index.cjs148.js +1 -1
- package/dist/index.cjs148.js.map +1 -1
- package/dist/index.cjs149.js +1 -1
- package/dist/index.cjs149.js.map +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs15.js.map +1 -1
- package/dist/index.cjs150.js +1 -1
- package/dist/index.cjs150.js.map +1 -1
- package/dist/index.cjs151.js +1 -1
- package/dist/index.cjs151.js.map +1 -1
- package/dist/index.cjs152.js +1 -1
- package/dist/index.cjs152.js.map +1 -1
- package/dist/index.cjs153.js +1 -1
- package/dist/index.cjs153.js.map +1 -1
- package/dist/index.cjs154.js +1 -1
- package/dist/index.cjs154.js.map +1 -1
- package/dist/index.cjs155.js +1 -1
- package/dist/index.cjs155.js.map +1 -1
- package/dist/index.cjs156.js +1 -1
- package/dist/index.cjs156.js.map +1 -1
- package/dist/index.cjs157.js +1 -1
- package/dist/index.cjs157.js.map +1 -1
- package/dist/index.cjs158.js +1 -1
- package/dist/index.cjs158.js.map +1 -1
- package/dist/index.cjs159.js +1 -1
- package/dist/index.cjs159.js.map +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs160.js +1 -1
- package/dist/index.cjs160.js.map +1 -1
- package/dist/index.cjs161.js +1 -1
- package/dist/index.cjs161.js.map +1 -1
- package/dist/index.cjs162.js +1 -1
- package/dist/index.cjs162.js.map +1 -1
- package/dist/index.cjs163.js +1 -1
- package/dist/index.cjs163.js.map +1 -1
- package/dist/index.cjs164.js +1 -1
- package/dist/index.cjs164.js.map +1 -1
- package/dist/index.cjs165.js +1 -1
- package/dist/index.cjs165.js.map +1 -1
- package/dist/index.cjs166.js +1 -1
- package/dist/index.cjs166.js.map +1 -1
- package/dist/index.cjs167.js +1 -1
- package/dist/index.cjs167.js.map +1 -1
- package/dist/index.cjs168.js +1 -1
- package/dist/index.cjs168.js.map +1 -1
- package/dist/index.cjs169.js +1 -1
- package/dist/index.cjs169.js.map +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs170.js +1 -1
- package/dist/index.cjs170.js.map +1 -1
- package/dist/index.cjs171.js +1 -1
- package/dist/index.cjs171.js.map +1 -1
- package/dist/index.cjs172.js +1 -1
- package/dist/index.cjs172.js.map +1 -1
- package/dist/index.cjs173.js +1 -1
- package/dist/index.cjs173.js.map +1 -1
- package/dist/index.cjs174.js +1 -1
- package/dist/index.cjs174.js.map +1 -1
- package/dist/index.cjs175.js +1 -1
- package/dist/index.cjs175.js.map +1 -1
- package/dist/index.cjs176.js +1 -1
- package/dist/index.cjs176.js.map +1 -1
- package/dist/index.cjs177.js +1 -1
- package/dist/index.cjs177.js.map +1 -1
- package/dist/index.cjs178.js +1 -1
- package/dist/index.cjs178.js.map +1 -1
- package/dist/index.cjs179.js +1 -1
- package/dist/index.cjs179.js.map +1 -1
- package/dist/index.cjs18.js +3 -6
- package/dist/index.cjs18.js.map +1 -1
- package/dist/index.cjs180.js +1 -1
- package/dist/index.cjs180.js.map +1 -1
- package/dist/index.cjs181.js +1 -1
- package/dist/index.cjs181.js.map +1 -1
- package/dist/index.cjs182.js +1 -1
- package/dist/index.cjs182.js.map +1 -1
- package/dist/index.cjs183.js +1 -1
- package/dist/index.cjs183.js.map +1 -1
- package/dist/index.cjs184.js +1 -4
- package/dist/index.cjs184.js.map +1 -1
- package/dist/index.cjs185.js +1 -1
- package/dist/index.cjs185.js.map +1 -1
- package/dist/index.cjs186.js +1 -1
- package/dist/index.cjs186.js.map +1 -1
- package/dist/index.cjs187.js +1 -1
- package/dist/index.cjs187.js.map +1 -1
- package/dist/index.cjs188.js +1 -1
- package/dist/index.cjs188.js.map +1 -1
- package/dist/index.cjs189.js +1 -1
- package/dist/index.cjs189.js.map +1 -1
- package/dist/index.cjs19.js +2 -2
- package/dist/index.cjs190.js +1 -1
- package/dist/index.cjs190.js.map +1 -1
- package/dist/index.cjs191.js +1 -1
- package/dist/index.cjs191.js.map +1 -1
- package/dist/index.cjs192.js +4 -1
- package/dist/index.cjs192.js.map +1 -1
- package/dist/index.cjs193.js +1 -1
- package/dist/index.cjs193.js.map +1 -1
- package/dist/index.cjs194.js +1 -1
- package/dist/index.cjs194.js.map +1 -1
- package/dist/index.cjs195.js +1 -1
- package/dist/index.cjs195.js.map +1 -1
- package/dist/index.cjs196.js +1 -1
- package/dist/index.cjs196.js.map +1 -1
- package/dist/index.cjs197.js +1 -1
- package/dist/index.cjs197.js.map +1 -1
- package/dist/index.cjs198.js +1 -1
- package/dist/index.cjs198.js.map +1 -1
- package/dist/index.cjs199.js +1 -1
- package/dist/index.cjs199.js.map +1 -1
- package/dist/index.cjs20.js +1 -1
- package/dist/index.cjs20.js.map +1 -1
- package/dist/index.cjs200.js +1 -1
- package/dist/index.cjs200.js.map +1 -1
- package/dist/index.cjs201.js +1 -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.cjs206.js +1 -1
- package/dist/index.cjs208.js +1 -1
- package/dist/index.cjs209.js +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs21.js.map +1 -1
- package/dist/index.cjs211.js +1 -1
- package/dist/index.cjs212.js +1 -1
- package/dist/index.cjs214.js +1 -1
- package/dist/index.cjs215.js +1 -1
- package/dist/index.cjs217.js +1 -1
- package/dist/index.cjs219.js +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs22.js.map +1 -1
- package/dist/index.cjs221.js +1 -1
- package/dist/index.cjs222.js +1 -1
- package/dist/index.cjs223.js +1 -1
- package/dist/index.cjs224.js +1 -1
- package/dist/index.cjs226.js +1 -1
- package/dist/index.cjs228.js +1 -1
- package/dist/index.cjs229.js +1 -1
- package/dist/index.cjs23.js +1 -1
- package/dist/index.cjs23.js.map +1 -1
- package/dist/index.cjs231.js +1 -1
- package/dist/index.cjs232.js +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 -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.cjs24.js.map +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.cjs25.js +1 -1
- package/dist/index.cjs25.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.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.cjs26.js +1 -1
- package/dist/index.cjs26.js.map +1 -1
- package/dist/index.cjs260.js +1 -1
- package/dist/index.cjs260.js.map +1 -1
- package/dist/index.cjs261.js +2 -0
- package/dist/index.cjs261.js.map +1 -0
- package/dist/index.cjs27.js +1 -1
- package/dist/index.cjs27.js.map +1 -1
- package/dist/index.cjs28.js +1 -1
- package/dist/index.cjs28.js.map +1 -1
- package/dist/index.cjs29.js +1 -1
- package/dist/index.cjs29.js.map +1 -1
- package/dist/index.cjs30.js +1 -1
- package/dist/index.cjs30.js.map +1 -1
- package/dist/index.cjs31.js +1 -1
- package/dist/index.cjs31.js.map +1 -1
- package/dist/index.cjs32.js +1 -1
- package/dist/index.cjs32.js.map +1 -1
- package/dist/index.cjs33.js +1 -1
- package/dist/index.cjs33.js.map +1 -1
- package/dist/index.cjs34.js +1 -1
- package/dist/index.cjs34.js.map +1 -1
- package/dist/index.cjs35.js +1 -1
- package/dist/index.cjs35.js.map +1 -1
- package/dist/index.cjs36.js +1 -1
- package/dist/index.cjs36.js.map +1 -1
- package/dist/index.cjs37.js +1 -1
- package/dist/index.cjs37.js.map +1 -1
- package/dist/index.cjs38.js +1 -1
- package/dist/index.cjs38.js.map +1 -1
- package/dist/index.cjs39.js +1 -1
- package/dist/index.cjs39.js.map +1 -1
- package/dist/index.cjs4.js +1 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs40.js +1 -1
- package/dist/index.cjs40.js.map +1 -1
- package/dist/index.cjs41.js +1 -1
- package/dist/index.cjs41.js.map +1 -1
- package/dist/index.cjs42.js +1 -1
- package/dist/index.cjs42.js.map +1 -1
- package/dist/index.cjs43.js +1 -1
- package/dist/index.cjs43.js.map +1 -1
- package/dist/index.cjs44.js +1 -1
- package/dist/index.cjs44.js.map +1 -1
- package/dist/index.cjs45.js +1 -1
- package/dist/index.cjs45.js.map +1 -1
- package/dist/index.cjs46.js +1 -1
- package/dist/index.cjs46.js.map +1 -1
- package/dist/index.cjs47.js +1 -1
- package/dist/index.cjs47.js.map +1 -1
- package/dist/index.cjs48.js +1 -1
- package/dist/index.cjs48.js.map +1 -1
- package/dist/index.cjs49.js +1 -1
- package/dist/index.cjs49.js.map +1 -1
- package/dist/index.cjs5.js +1 -1
- package/dist/index.cjs50.js +1 -1
- package/dist/index.cjs50.js.map +1 -1
- package/dist/index.cjs51.js +1 -1
- package/dist/index.cjs51.js.map +1 -1
- package/dist/index.cjs52.js +1 -1
- package/dist/index.cjs52.js.map +1 -1
- package/dist/index.cjs53.js +1 -1
- package/dist/index.cjs53.js.map +1 -1
- package/dist/index.cjs54.js +1 -440
- package/dist/index.cjs54.js.map +1 -1
- package/dist/index.cjs55.js +440 -1
- package/dist/index.cjs55.js.map +1 -1
- package/dist/index.cjs56.js +1 -1
- package/dist/index.cjs56.js.map +1 -1
- package/dist/index.cjs57.js +1 -1
- package/dist/index.cjs57.js.map +1 -1
- package/dist/index.cjs58.js +1 -1
- package/dist/index.cjs58.js.map +1 -1
- package/dist/index.cjs59.js +1 -9
- package/dist/index.cjs59.js.map +1 -1
- package/dist/index.cjs6.js +1 -1
- package/dist/index.cjs60.js +1 -19
- package/dist/index.cjs60.js.map +1 -1
- package/dist/index.cjs61.js +1 -1
- package/dist/index.cjs63.js +9 -1
- package/dist/index.cjs63.js.map +1 -1
- package/dist/index.cjs64.js +19 -1
- package/dist/index.cjs64.js.map +1 -1
- package/dist/index.cjs65.js +1 -1
- package/dist/index.cjs65.js.map +1 -1
- package/dist/index.cjs66.js +1 -1
- package/dist/index.cjs66.js.map +1 -1
- package/dist/index.cjs67.js +1 -1
- package/dist/index.cjs67.js.map +1 -1
- package/dist/index.cjs68.js +1 -1
- package/dist/index.cjs68.js.map +1 -1
- package/dist/index.cjs69.js +1 -1
- package/dist/index.cjs69.js.map +1 -1
- package/dist/index.cjs7.js +1 -1
- package/dist/index.cjs70.js +1 -1
- package/dist/index.cjs70.js.map +1 -1
- package/dist/index.cjs71.js +1 -1
- package/dist/index.cjs71.js.map +1 -1
- package/dist/index.cjs72.js +1 -1
- package/dist/index.cjs72.js.map +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 -1
- package/dist/index.cjs75.js.map +1 -1
- package/dist/index.cjs76.js +1 -1
- package/dist/index.cjs76.js.map +1 -1
- package/dist/index.cjs77.js +1 -1
- package/dist/index.cjs78.js +1 -1
- package/dist/index.cjs78.js.map +1 -1
- package/dist/index.cjs79.js +1 -1
- package/dist/index.cjs79.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs80.js +1 -1
- package/dist/index.cjs80.js.map +1 -1
- package/dist/index.cjs81.js +1 -1
- package/dist/index.cjs81.js.map +1 -1
- package/dist/index.cjs82.js +1 -1
- package/dist/index.cjs82.js.map +1 -1
- package/dist/index.cjs83.js +1 -1
- package/dist/index.cjs83.js.map +1 -1
- package/dist/index.cjs84.js +1 -1
- package/dist/index.cjs84.js.map +1 -1
- package/dist/index.cjs85.js +1 -1
- package/dist/index.cjs85.js.map +1 -1
- package/dist/index.cjs86.js +1 -1
- package/dist/index.cjs86.js.map +1 -1
- package/dist/index.cjs87.js +1 -1
- package/dist/index.cjs87.js.map +1 -1
- package/dist/index.cjs88.js +1 -1
- package/dist/index.cjs88.js.map +1 -1
- package/dist/index.cjs89.js +1 -1
- package/dist/index.cjs89.js.map +1 -1
- package/dist/index.cjs90.js +1 -1
- package/dist/index.cjs90.js.map +1 -1
- package/dist/index.cjs91.js +1 -1
- package/dist/index.cjs91.js.map +1 -1
- package/dist/index.cjs92.js +1 -1
- package/dist/index.cjs92.js.map +1 -1
- package/dist/index.cjs93.js +1 -1
- package/dist/index.cjs93.js.map +1 -1
- package/dist/index.cjs94.js +1 -1
- package/dist/index.cjs94.js.map +1 -1
- package/dist/index.cjs95.js +1 -1
- package/dist/index.cjs95.js.map +1 -1
- package/dist/index.cjs96.js +1 -1
- package/dist/index.cjs96.js.map +1 -1
- package/dist/index.cjs97.js +1 -1
- package/dist/index.cjs97.js.map +1 -1
- package/dist/index.cjs98.js +1 -1
- package/dist/index.cjs98.js.map +1 -1
- package/dist/index.cjs99.js +1 -1
- package/dist/index.cjs99.js.map +1 -1
- package/dist/index.es100.js +10 -3
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +11 -14
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +12 -11
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +85 -6
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +3 -7
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +14 -6
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +11 -7
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +6 -3
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +7 -4
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +6 -3
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es110.js +7 -6
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +4 -7
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +4 -4
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +4 -8
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +6 -12
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +6 -10
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +2 -2
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +7 -5
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +12 -2
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +10 -7
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es12.js +6 -6
- package/dist/index.es120.js +3 -7
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +4 -6
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +2 -8
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +7 -3
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +8 -4
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +6 -56
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +8 -13
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +2 -4
- package/dist/index.es127.js.map +1 -1
- package/dist/index.es128.js +3 -5
- package/dist/index.es128.js.map +1 -1
- package/dist/index.es129.js +56 -7
- package/dist/index.es129.js.map +1 -1
- package/dist/index.es130.js +13 -16
- package/dist/index.es130.js.map +1 -1
- package/dist/index.es131.js +5 -13
- package/dist/index.es131.js.map +1 -1
- package/dist/index.es132.js +5 -4
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +7 -4
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +15 -7
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +13 -6
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +4 -6
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +5 -8
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +9 -3
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +7 -3
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es14.js +2 -2
- package/dist/index.es140.js +6 -10
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +9 -5
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +3 -4
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +3 -9
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +10 -5
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +5 -17
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +4 -12
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +9 -3
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +6 -3
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +16 -8
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es15.js +8 -8
- package/dist/index.es15.js.map +1 -1
- package/dist/index.es150.js +11 -6
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es151.js +3 -13
- package/dist/index.es151.js.map +1 -1
- package/dist/index.es152.js +3 -13
- package/dist/index.es152.js.map +1 -1
- package/dist/index.es153.js +8 -6
- package/dist/index.es153.js.map +1 -1
- package/dist/index.es154.js +6 -5
- package/dist/index.es154.js.map +1 -1
- package/dist/index.es155.js +12 -5
- package/dist/index.es155.js.map +1 -1
- package/dist/index.es156.js +12 -16
- package/dist/index.es156.js.map +1 -1
- package/dist/index.es157.js +6 -16
- package/dist/index.es157.js.map +1 -1
- package/dist/index.es158.js +5 -4
- package/dist/index.es158.js.map +1 -1
- package/dist/index.es159.js +5 -16
- package/dist/index.es159.js.map +1 -1
- package/dist/index.es16.js +1 -1
- package/dist/index.es160.js +16 -22
- package/dist/index.es160.js.map +1 -1
- package/dist/index.es161.js +17 -6
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +5 -5
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +17 -6
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +23 -5
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +6 -12
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +4 -5
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +6 -5
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es168.js +5 -5
- package/dist/index.es168.js.map +1 -1
- package/dist/index.es169.js +11 -4
- package/dist/index.es169.js.map +1 -1
- package/dist/index.es17.js +3 -3
- package/dist/index.es170.js +5 -4
- package/dist/index.es170.js.map +1 -1
- package/dist/index.es171.js +4 -4
- package/dist/index.es171.js.map +1 -1
- package/dist/index.es172.js +4 -4
- package/dist/index.es172.js.map +1 -1
- package/dist/index.es173.js +4 -12
- package/dist/index.es173.js.map +1 -1
- package/dist/index.es174.js +4 -14
- package/dist/index.es174.js.map +1 -1
- package/dist/index.es175.js +4 -8
- package/dist/index.es175.js.map +1 -1
- package/dist/index.es176.js +4 -6
- package/dist/index.es176.js.map +1 -1
- package/dist/index.es177.js +12 -6
- package/dist/index.es177.js.map +1 -1
- package/dist/index.es178.js +13 -7
- package/dist/index.es178.js.map +1 -1
- package/dist/index.es179.js +8 -27
- package/dist/index.es179.js.map +1 -1
- package/dist/index.es18.js +2832 -15806
- package/dist/index.es18.js.map +1 -1
- package/dist/index.es180.js +6 -50
- package/dist/index.es180.js.map +1 -1
- package/dist/index.es181.js +6 -64
- package/dist/index.es181.js.map +1 -1
- package/dist/index.es182.js +8 -7
- package/dist/index.es182.js.map +1 -1
- package/dist/index.es183.js +315 -142
- package/dist/index.es183.js.map +1 -1
- package/dist/index.es184.js +73 -12195
- package/dist/index.es184.js.map +1 -1
- package/dist/index.es185.js +5 -3
- package/dist/index.es185.js.map +1 -1
- package/dist/index.es186.js +18 -3
- package/dist/index.es186.js.map +1 -1
- package/dist/index.es187.js +9 -34
- package/dist/index.es187.js.map +1 -1
- package/dist/index.es188.js +33 -3
- package/dist/index.es188.js.map +1 -1
- package/dist/index.es189.js +4 -22
- package/dist/index.es189.js.map +1 -1
- package/dist/index.es19.js +4 -4
- package/dist/index.es190.js +10 -2
- package/dist/index.es190.js.map +1 -1
- package/dist/index.es191.js +150 -3
- package/dist/index.es191.js.map +1 -1
- package/dist/index.es192.js +12199 -2
- package/dist/index.es192.js.map +1 -1
- package/dist/index.es193.js +3 -34
- package/dist/index.es193.js.map +1 -1
- package/dist/index.es194.js +2 -14
- package/dist/index.es194.js.map +1 -1
- package/dist/index.es195.js +35 -13
- package/dist/index.es195.js.map +1 -1
- package/dist/index.es196.js +3 -11
- package/dist/index.es196.js.map +1 -1
- package/dist/index.es197.js +21 -319
- package/dist/index.es197.js.map +1 -1
- package/dist/index.es198.js +2 -77
- package/dist/index.es198.js.map +1 -1
- package/dist/index.es199.js +3 -5
- package/dist/index.es199.js.map +1 -1
- package/dist/index.es20.js +1 -8
- package/dist/index.es20.js.map +1 -1
- package/dist/index.es200.js +2 -18
- package/dist/index.es200.js.map +1 -1
- package/dist/index.es201.js +31 -10
- package/dist/index.es201.js.map +1 -1
- package/dist/index.es202.js +13 -31
- package/dist/index.es202.js.map +1 -1
- package/dist/index.es203.js +13 -4
- package/dist/index.es203.js.map +1 -1
- package/dist/index.es204.js +9 -2
- package/dist/index.es204.js.map +1 -1
- package/dist/index.es205.js +1 -1
- package/dist/index.es206.js +1 -1
- package/dist/index.es208.js +1 -1
- package/dist/index.es209.js +1 -1
- package/dist/index.es21.js +5 -5
- package/dist/index.es21.js.map +1 -1
- package/dist/index.es211.js +2 -2
- package/dist/index.es212.js +2 -2
- package/dist/index.es214.js +2 -2
- package/dist/index.es215.js +2 -2
- package/dist/index.es217.js +2 -2
- package/dist/index.es219.js +1 -1
- package/dist/index.es22.js +6 -5
- package/dist/index.es22.js.map +1 -1
- package/dist/index.es221.js +1 -1
- package/dist/index.es222.js +6 -6
- package/dist/index.es223.js +1 -1
- package/dist/index.es224.js +2 -2
- package/dist/index.es226.js +2 -2
- package/dist/index.es228.js +1 -1
- package/dist/index.es229.js +1 -1
- package/dist/index.es23.js +5 -28
- package/dist/index.es23.js.map +1 -1
- package/dist/index.es231.js +1 -1
- package/dist/index.es232.js +1 -1
- package/dist/index.es234.js +2 -3
- package/dist/index.es234.js.map +1 -1
- package/dist/index.es235.js +3 -6
- package/dist/index.es235.js.map +1 -1
- package/dist/index.es236.js +1 -1
- package/dist/index.es237.js +5 -24
- package/dist/index.es237.js.map +1 -1
- package/dist/index.es238.js +23 -15
- package/dist/index.es238.js.map +1 -1
- package/dist/index.es239.js +15 -29
- package/dist/index.es239.js.map +1 -1
- package/dist/index.es24.js +28 -8
- package/dist/index.es24.js.map +1 -1
- package/dist/index.es240.js +29 -20
- package/dist/index.es240.js.map +1 -1
- package/dist/index.es241.js +21 -75
- package/dist/index.es241.js.map +1 -1
- package/dist/index.es242.js +73 -18
- package/dist/index.es242.js.map +1 -1
- package/dist/index.es243.js +19 -47
- package/dist/index.es243.js.map +1 -1
- package/dist/index.es244.js +42 -48
- package/dist/index.es244.js.map +1 -1
- package/dist/index.es245.js +54 -8
- package/dist/index.es245.js.map +1 -1
- package/dist/index.es246.js +8 -20
- package/dist/index.es246.js.map +1 -1
- package/dist/index.es247.js +18 -63
- package/dist/index.es247.js.map +1 -1
- package/dist/index.es248.js +64 -41
- package/dist/index.es248.js.map +1 -1
- package/dist/index.es249.js +41 -64
- package/dist/index.es249.js.map +1 -1
- package/dist/index.es25.js +8 -5
- package/dist/index.es25.js.map +1 -1
- package/dist/index.es250.js +64 -7
- package/dist/index.es250.js.map +1 -1
- package/dist/index.es251.js +8 -3
- package/dist/index.es251.js.map +1 -1
- package/dist/index.es252.js +3 -12
- package/dist/index.es252.js.map +1 -1
- package/dist/index.es253.js +11 -58
- package/dist/index.es253.js.map +1 -1
- package/dist/index.es254.js +57 -54
- package/dist/index.es254.js.map +1 -1
- package/dist/index.es255.js +56 -2
- package/dist/index.es255.js.map +1 -1
- package/dist/index.es256.js +2 -4
- package/dist/index.es256.js.map +1 -1
- package/dist/index.es257.js +1 -1
- package/dist/index.es258.js +4 -70
- package/dist/index.es258.js.map +1 -1
- package/dist/index.es259.js +70 -3
- package/dist/index.es259.js.map +1 -1
- package/dist/index.es26.js +5 -10
- package/dist/index.es26.js.map +1 -1
- package/dist/index.es260.js +3 -24
- package/dist/index.es260.js.map +1 -1
- package/dist/index.es261.js +28 -0
- package/dist/index.es261.js.map +1 -0
- package/dist/index.es27.js +10 -17
- package/dist/index.es27.js.map +1 -1
- package/dist/index.es28.js +17 -5
- package/dist/index.es28.js.map +1 -1
- package/dist/index.es29.js +5 -5
- package/dist/index.es29.js.map +1 -1
- package/dist/index.es30.js +5 -5
- package/dist/index.es30.js.map +1 -1
- package/dist/index.es31.js +4 -6
- package/dist/index.es31.js.map +1 -1
- package/dist/index.es32.js +6 -6
- package/dist/index.es32.js.map +1 -1
- package/dist/index.es33.js +7 -4
- package/dist/index.es33.js.map +1 -1
- package/dist/index.es34.js +1 -1
- package/dist/index.es34.js.map +1 -1
- package/dist/index.es35.js +4 -7
- package/dist/index.es35.js.map +1 -1
- package/dist/index.es36.js +7 -15
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +14 -11
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +11 -14
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +14 -6
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es4.js +6 -5
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es40.js +7 -5
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +5 -4
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +4 -18
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +17 -17
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +17 -13
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +13 -5
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +5 -6
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +6 -9
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es48.js +10 -4
- package/dist/index.es48.js.map +1 -1
- package/dist/index.es49.js +4 -19
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es5.js +5 -5
- package/dist/index.es50.js +21 -1
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +1 -18
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +18 -1
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +1 -86
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +71 -13817
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +13830 -9
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +8 -9
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +9 -84
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +85 -2
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +5 -29
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es6.js +2 -2
- package/dist/index.es60.js +2 -602
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +2 -6
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +2 -2
- package/dist/index.es63.js +30 -2
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +601 -106
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +107 -10
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +10 -2
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +55 -2
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +47 -56
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +37 -46
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es7.js +2 -2
- package/dist/index.es70.js +11 -38
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +13 -10
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +29 -14
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +14 -29
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +12 -13
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +12 -13
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +2 -11
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +2 -273
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +27 -14
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +49 -17
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es8.js +39 -38
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es80.js +64 -4
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +273 -4
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +14 -3
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es83.js +18 -4
- package/dist/index.es83.js.map +1 -1
- package/dist/index.es84.js +3 -2
- package/dist/index.es84.js.map +1 -1
- package/dist/index.es85.js +4 -3
- package/dist/index.es85.js.map +1 -1
- package/dist/index.es86.js +4 -3
- package/dist/index.es86.js.map +1 -1
- package/dist/index.es87.js +5 -3
- package/dist/index.es87.js.map +1 -1
- package/dist/index.es88.js +4 -3
- package/dist/index.es88.js.map +1 -1
- package/dist/index.es89.js +3 -3
- package/dist/index.es89.js.map +1 -1
- package/dist/index.es90.js +3 -3
- package/dist/index.es90.js.map +1 -1
- package/dist/index.es91.js +3 -3
- package/dist/index.es91.js.map +1 -1
- package/dist/index.es92.js +3 -10
- package/dist/index.es92.js.map +1 -1
- package/dist/index.es93.js +3 -4
- package/dist/index.es93.js.map +1 -1
- package/dist/index.es94.js +3 -6
- package/dist/index.es94.js.map +1 -1
- package/dist/index.es95.js +3 -6
- package/dist/index.es95.js.map +1 -1
- package/dist/index.es96.js +9 -9
- package/dist/index.es96.js.map +1 -1
- package/dist/index.es97.js +4 -12
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +5 -12
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +5 -85
- package/dist/index.es99.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/GeocodingControl.css +3 -0
- package/src/components/GeocodingControl.js +1 -0
- package/src/components/MapDraw.js +6 -3
- package/types/components/GeocodingControl.js.flow +1 -0
- package/types/components/LocationMarker.js.flow +82 -0
- package/types/components/MapDraw.js.flow +6 -3
package/dist/index.cjs19.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const lu=require("./index.cjs61.js"),cu=require("./index.cjs63.js");function ld(an,vl){for(var Ur=0;Ur<vl.length;Ur++){const cr=vl[Ur];if(typeof cr!="string"&&!Array.isArray(cr)){for(const $r in cr)if($r!=="default"&&!($r in an)){const Ns=Object.getOwnPropertyDescriptor(cr,$r);Ns&&Object.defineProperty(an,$r,Ns.get?Ns:{enumerable:!0,get:()=>cr[$r]})}}}return Object.freeze(Object.defineProperty(an,Symbol.toStringTag,{value:"Module"}))}(function(an,vl){(function(Ur,cr){an.exports=cr()})(lu.commonjsGlobal,function(){var Ur,cr,$r;function Ns(c,Wi){if(!Ur)Ur=Wi;else if(!cr)cr=Wi;else{var ie="var sharedChunk = {}; ("+Ur+")(sharedChunk); ("+cr+")(sharedChunk);",Hi={};Ur(Hi),$r=Wi(Hi),typeof window<"u"&&($r.workerUrl=window.URL.createObjectURL(new Blob([ie],{type:"text/javascript"})))}}Ns(["exports"],function(c){function Wi(i,e,r,a){return new(r||(r=Promise))(function(o,u){function d(x){try{_(a.next(x))}catch(b){u(b)}}function f(x){try{_(a.throw(x))}catch(b){u(b)}}function _(x){var b;x.done?o(x.value):(b=x.value,b instanceof r?b:new r(function(T){T(b)})).then(d,f)}_((a=a.apply(i,e||[])).next())})}function ie(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Hi=ci;function ci(i,e){this.x=i,this.y=e}ci.prototype={clone:function(){return new ci(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),o=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ci.convert=function(i){return i instanceof ci?i:Array.isArray(i)?new ci(i[0],i[1]):i};var Be=ie(Hi),us=Us;function Us(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}Us.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=o/u}var d=0,f=1;for(r=i,a=0;a<20&&(o=this.sampleCurveX(r),!(Math.abs(o-i)<e));a++)i>o?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var ps=ie(us);let ei,Pt;function ma(){return ei==null&&(ei=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ei}function Ir(){if(Pt==null&&(Pt=!1,ma())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<5*5;a++){const o=4*a;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){Pt=!0;break}}}return Pt||!1}function $s(i,e,r,a){const o=new ps(i,e,r,a);return function(u){return o.solve(u)}}const ds=$s(.25,.1,.25,1);function Ki(i,e,r){return Math.min(r,Math.max(e,i))}function js(i,e,r){const a=r-e,o=((i-e)%a+a)%a+e;return o===e?r:o}function $t(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}let ga=1;function mt(i,e,r){const a={};for(const o in i)a[o]=e.call(r||this,i[o],o,i);return a}function fs(i,e,r){const a={};for(const o in i)e.call(r||this,i[o],o,i)&&(a[o]=i[o]);return a}function $i(i){return Array.isArray(i)?i.map($i):typeof i=="object"&&i?mt(i,$i):i}const Ar={};function ti(i){Ar[i]||(typeof console<"u"&&console.warn(i),Ar[i]=!0)}function vi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function hr(i){let e=0;for(let r,a,o=0,u=i.length,d=u-1;o<u;d=o++)r=i[o],a=i[d],e+=(a.x-r.x)*(r.y+a.y);return e}function ki(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let jr=null;function qs(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const _a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Zs(i,e,r,a,o){return Wi(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u==null?void 0:u.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(a*o*4);if(yield u.copyTo(_,function(x,b,T,A,C){const P=4*Math.max(-b,0),D=(Math.max(0,T)-T)*A*4+P,V=4*A,$=Math.max(0,b),H=Math.max(0,T);return{rect:{x:$,y:H,width:Math.min(x.width,b+A)-$,height:Math.min(x.height,T+C)-H},layout:[{offset:D,stride:V}]}}(i,e,r,a,o)),f)for(let x=0;x<_.length;x+=4){const b=_[x];_[x]=_[x+2],_[x+2]=b}return _}finally{u.close()}})}let Yi,ct,hi,qr;const ms={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(hi||(hi=document.createElement("a")),hi.href=i,hi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(qr==null&&(qr=matchMedia("(prefers-reduced-motion: reduce)")),qr.matches)}},gs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Mr extends Error{constructor(e,r,a,o){super(`AJAXError: ${r} (${e}): ${a}`),this.status=e,this.statusText=r,this.url=a,this.body=o}}const ji=ki()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,zi=i=>gs.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function Gs(i,e){const r=new AbortController,a=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:ji(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&a.headers.set("Accept","application/json"),u||fetch(a).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(_=>{u||(o=!0,e(null,_,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(_=>{u||e(new Error(_.message))})})(d):d.blob().then(f=>e(new Mr(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const Er=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(ki()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!ki())return(zi(i.url)||Gs)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ji())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Gs(i,e);if(ki()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(a,o){const u=new XMLHttpRequest;u.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(u.responseType="arraybuffer");for(const d in a.headers)u.setRequestHeader(d,a.headers[d]);return a.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=a.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(a.type==="json")try{d=JSON.parse(u.response)}catch(f){return o(f)}o(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new Mr(u.status,u.statusText,a.url,d))}},u.send(a.body),{cancel:()=>u.abort()}}(i,e)},Xs=function(i,e){return Er($t(i,{type:"arrayBuffer"}),e)};function ur(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function _s(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Zr(i,e,r){if(r&&r[i]){const a=r[i].indexOf(e);a!==-1&&r[i].splice(a,1)}}class Cr{constructor(e,r={}){$t(this,r),this.type=e}}class Pr extends Cr{constructor(e,r={}){super("error",$t({error:e},r))}}class Gr{on(e,r){return this._listeners=this._listeners||{},_s(e,r,this._listeners),this}off(e,r){return Zr(e,r,this._listeners),Zr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},_s(e,r,this._oneTimeListeners),this):new Promise(a=>this.once(e,a))}fire(e,r){typeof e=="string"&&(e=new Cr(e,r||{}));const a=e.type;if(this.listens(a)){e.target=this;const o=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const f of u)Zr(a,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&($t(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Pr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var re={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},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:{},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_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"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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 ui=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Di(i,e){const r={};for(const a in i)a!=="ref"&&(r[a]=i[a]);return ui.forEach(a=>{a in e&&(r[a]=e[a])}),r}function nt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!nt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!nt(i[r],e[r]))return!1;return!0}return i===e}const Ye={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Ji(i,e,r){r.push({command:Ye.addSource,args:[i,e[i]]})}function ys(i,e,r){e.push({command:Ye.removeSource,args:[i]}),r[i]=!0}function pr(i,e,r,a){ys(i,r,a),Ji(i,e,r)}function ya(i,e,r){let a;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&a!=="data"&&!nt(i[r][a],e[r][a]))return!1;for(a in e[r])if(Object.prototype.hasOwnProperty.call(e[r],a)&&a!=="data"&&!nt(i[r][a],e[r][a]))return!1;return!0}function xs(i,e,r,a,o,u){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(nt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(nt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}))}function kr(i){return i.id}function Xr(i,e){return i[e.id]=e,i}class fe{constructor(e,r,a,o){this.message=(e?`${e}: `:"")+a,o&&(this.identifier=o),r!=null&&r.__line__&&(this.line=r.__line__)}}function Qi(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}class vt extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Wr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[a,o]of r)this.bindings[a]=o}concat(e){return new Wr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const dr={kind:"null"},ge={kind:"number"},Ue={kind:"string"},Fe={kind:"boolean"},ii={kind:"color"},er={kind:"object"},Ve={kind:"value"},fr={kind:"collator"},R={kind:"formatted"},I={kind:"padding"},M={kind:"resolvedImage"},k={kind:"variableAnchorOffsetCollection"};function O(i,e){return{kind:"array",itemType:i,N:e}}function N(i){if(i.kind==="array"){const e=N(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const K=[dr,ge,Ue,Fe,ii,R,er,O(Ve),I,M,k];function Z(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Z(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of K)if(!Z(r,e))return null}}return`Expected ${N(i)} but found ${N(e)} instead.`}function j(i,e){return e.some(r=>r.kind===i.kind)}function W(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function se(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const ae=.96422,le=.82521,Pe=4/29,Re=6/29,Te=3*Re*Re,ze=Re*Re*Re,Oe=Math.PI/180,tt=180/Math.PI;function st(i){return(i%=360)<0&&(i+=360),i}function Ke([i,e,r,a]){let o,u;const d=Wt((.2225045*(i=He(i))+.7168786*(e=He(e))+.0606169*(r=He(r)))/1);i===e&&e===r?o=u=d:(o=Wt((.4360747*i+.3850649*e+.1430804*r)/ae),u=Wt((.0139322*i+.0971045*e+.7141733*r)/le));const f=116*d-16;return[f<0?0:f,500*(o-d),200*(d-u),a]}function He(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Wt(i){return i>ze?Math.pow(i,1/3):i/Te+Pe}function ot([i,e,r,a]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,d=isNaN(r)?o:o-r/200;return o=1*jt(o),u=ae*jt(u),d=le*jt(d),[kt(3.1338561*u-1.6168667*o-.4906146*d),kt(-.9787684*u+1.9161415*o+.033454*d),kt(.0719453*u-.2289914*o+1.4052427*d),a]}function kt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function jt(i){return i>Re?i*i*i:Te*(i-Pe)}function Li(i){return parseInt(i.padEnd(2,i),16)/255}function po(i,e){return vs(e?i/100:i,0,1)}function vs(i,e,r){return Math.min(Math.max(e,i),r)}function bs(i){return!i.some(Number.isNaN)}const bl={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]};class it{constructor(e,r,a,o=1,u=!0){this.r=e,this.g=r,this.b=a,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,a,o]))}static parse(e){if(e instanceof it)return e;if(typeof e!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=bl[a];if(o){const[d,f,_]=o;return[d/255,f/255,_/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const d=a.length<6?1:2;let f=1;return[Li(a.slice(f,f+=d)),Li(a.slice(f,f+=d)),Li(a.slice(f,f+=d)),Li(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){const d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,x,b,T,A,C,P,D,V,$,H]=d,q=[b||" ",C||" ",V].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const Y=[x,A,D].join(""),Q=Y==="%%%"?100:Y===""?255:0;if(Q){const oe=[vs(+_/Q,0,1),vs(+T/Q,0,1),vs(+P/Q,0,1),$?po(+$,H):1];if(bs(oe))return oe}}return}}const u=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,x,b,T,A,C,P]=u,D=[_||" ",b||" ",A].join("");if(D===" "||D===" /"||D===",,"||D===",,,"){const V=[+f,vs(+x,0,100),vs(+T,0,100),C?po(+C,P):1];if(bs(V))return function([$,H,q,Y]){function Q(oe){const be=(oe+$/30)%12,Ae=H*Math.min(q,1-q);return q-Ae*Math.max(-1,Math.min(be-3,9-be,1))}return $=st($),H/=100,q/=100,[Q(0),Q(8),Q(4),Y]}(V)}}}(e);return r?new it(...r,!1):void 0}get rgb(){const{r:e,g:r,b:a,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,a/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,a,o,u]=Ke(e),d=Math.sqrt(a*a+o*o);return[Math.round(1e4*d)?st(Math.atan2(o,a)*tt):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ke(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,a,o]=this.rgb;return`rgba(${[e,r,a].map(u=>Math.round(255*u)).join(",")},${o})`}}it.black=new it(0,0,0,1),it.white=new it(1,1,1,1),it.transparent=new it(0,0,0,0),it.red=new it(1,0,0,1);class nn{constructor(e,r,a){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class xa{constructor(e,r,a,o,u){this.text=e,this.image=r,this.scale=a,this.fontStack=o,this.textColor=u}}class Ht{constructor(e){this.sections=e}static fromString(e){return new Ht([new xa(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ht?e:Ht.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bi)return e;if(typeof e=="number")return new bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new bi(e)}}toString(){return JSON.stringify(this.values)}}const wl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const a=e[r],o=e[r+1];if(typeof a!="string"||!wl.has(a)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Bi(e)}}toString(){return JSON.stringify(this.values)}}class qt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new qt({name:e,available:!1}):null}}function va(i,e,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,e,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,e,r,a]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ws(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof it||i instanceof nn||i instanceof Ht||i instanceof bi||i instanceof Bi||i instanceof qt)return!0;if(Array.isArray(i)){for(const e of i)if(!ws(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ws(i[e]))return!1;return!0}return!1}function gt(i){if(i===null)return dr;if(typeof i=="string")return Ue;if(typeof i=="boolean")return Fe;if(typeof i=="number")return ge;if(i instanceof it)return ii;if(i instanceof nn)return fr;if(i instanceof Ht)return R;if(i instanceof bi)return I;if(i instanceof Bi)return k;if(i instanceof qt)return M;if(Array.isArray(i)){const e=i.length;let r;for(const a of i){const o=gt(a);if(r){if(r===o)continue;r=Ve;break}r=o}return O(r||Ve,e)}return er}function Je(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof it||i instanceof Ht||i instanceof bi||i instanceof Bi||i instanceof qt?i.toString():JSON.stringify(i)}class Hr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ws(e[1]))return r.error("invalid value");const a=e[1];let o=gt(a);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new Hr(o,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class bt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ba={string:Ue,number:ge,boolean:Fe,object:er};class Ri{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let a,o=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in ba)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=ba[x],o++}else f=Ve;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],o++}a=O(f,_)}else{if(!ba[u])throw new Error(`Types doesn't contain name = ${u}`);a=ba[u]}const d=[];for(;o<e.length;o++){const f=r.parse(e[o],o,Ve);if(!f)return null;d.push(f)}return new Ri(a,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(e);if(!Z(this.type,gt(a)))return a;if(r===this.args.length-1)throw new bt(`Expected value to be of type ${N(this.type)}, but found ${N(gt(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const on={"to-boolean":Fe,"to-color":ii,"to-number":ge,"to-string":Ue};class zr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[0];if(!on[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=on[a],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,Ve);if(!f)return null;u.push(f)}return new zr(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,a;for(const o of this.args){if(r=o.evaluate(e),a=null,r instanceof it)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:va(r[0],r[1],r[2],r[3]),!a))return new it(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new bt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(e);const o=bi.parse(r);if(o)return o}throw new bt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(e);const o=Bi.parse(r);if(o)return o}throw new bt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new bt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ht.fromString(Je(this.args[0].evaluate(e)));case"resolvedImage":return qt.fromString(Je(this.args[0].evaluate(e)));default:return Je(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const fo=["Unknown","Point","LineString","Polygon"];class ln{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?fo[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=it.parse(e)),r}}class wa{constructor(e,r,a=[],o,u=new Wr,d=[]){this.registry=e,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=o,this._isConstant=r}parse(e,r,a,o,u={}){return r?this.concat(r,a,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function a(o,u,d){return d==="assert"?new Ri(u,[o]):d==="coerce"?new zr(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Hr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new ln;try{d=new Hr(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,a){const o=typeof e=="number"?this.path.concat(e):this.path,u=a?this.scope.concat(a):this.scope;return new wa(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const a=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new vt(a,e))}checkSubtype(e,r){const a=Z(e,r);return a&&this.error(a),a}}class Sa{constructor(e,r,a){this.type=fr,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const o=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Fe);if(!o)return null;const u=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Fe);if(!u)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,Ue),!d)?null:new Sa(o,u,d)}evaluate(e){return new nn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Dr=8192;function cn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ws(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function mo(i,e){const r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*Dr),Math.round(a*o*Dr)]}function Sl(i,e,r){const a=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return a*d-u*o==0&&a*u<=0&&o*d<=0}function hn(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const _=e[d];for(let x=0,b=_.length;x<b-1;x++){if(Sl(i,_[x],_[x+1]))return!1;(o=_[x])[1]>(a=i)[1]!=(u=_[x+1])[1]>a[1]&&a[0]<(u[0]-o[0])*(a[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var a,o,u;return r}function un(i,e){for(let r=0;r<e.length;r++)if(hn(i,e[r]))return!0;return!1}function go(i,e,r,a){const o=a[0]-r[0],u=a[1]-r[1],d=(i[0]-r[0])*u-o*(i[1]-r[1]),f=(e[0]-r[0])*u-o*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Tl(i,e,r){for(const x of r)for(let b=0;b<x.length-1;++b)if((f=[(d=x[b+1])[0]-(u=x[b])[0],d[1]-u[1]])[0]*(_=[(o=e)[0]-(a=i)[0],o[1]-a[1]])[1]-f[1]*_[0]!=0&&go(a,o,u,d)&&go(u,d,a,o))return!0;var a,o,u,d,f,_;return!1}function _o(i,e){for(let r=0;r<i.length;++r)if(!hn(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Tl(i[r],i[r+1],e))return!1;return!0}function yo(i,e){for(let r=0;r<e.length;r++)if(_o(i,e[r]))return!0;return!1}function Ta(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=[];for(let d=0;d<i[o].length;d++){const f=mo(i[o][d],r);cn(e,f),u.push(f)}a.push(u)}return a}function xo(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=Ta(i[o],e,r);a.push(u)}return a}function vo(i,e,r,a){if(i[0]<r[0]||i[0]>r[2]){const o=.5*a;let u=i[0]-r[0]>o?-a:r[0]-i[0]>o?a:0;u===0&&(u=i[0]-r[2]>o?-a:r[2]-i[0]>o?a:0),i[0]+=u}cn(e,i)}function pn(i,e,r,a){const o=Math.pow(2,a.z)*Dr,u=[a.x*Dr,a.y*Dr],d=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];vo(x,e,r,o),d.push(x)}return d}function dn(i,e,r,a){const o=Math.pow(2,a.z)*Dr,u=[a.x*Dr,a.y*Dr],d=[];for(const _ of i){const x=[];for(const b of _){const T=[b.x+u[0],b.y+u[1]];cn(e,T),x.push(T)}d.push(x)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const x of _)vo(x,e,r,o)}var f;return d}class Kr{constructor(e,r){this.type=Fe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ws(e[1])){const a=e[1];if(a.type==="FeatureCollection")for(let o=0;o<a.features.length;++o){const u=a.features[o].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Kr(a,a.features[o].geometry)}else if(a.type==="Feature"){const o=a.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Kr(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Kr(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=Ta(a.coordinates,u,d),_=pn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!hn(x,f))return!1}if(a.type==="MultiPolygon"){const f=xo(a.coordinates,u,d),_=pn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!un(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=Ta(a.coordinates,u,d),_=dn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!_o(x,f))return!1}if(a.type==="MultiPolygon"){const f=xo(a.coordinates,u,d),_=dn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!yo(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ia{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=e[1];return r.scope.has(a)?new Ia(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Fi{constructor(e,r,a,o){this.name=e,this.type=r,this._evaluate=a,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const a=e[0],o=Fi.definitions[a];if(!o)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,d=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,b]of f){_=new wa(r.registry,Aa,r.path,null,r.scope);const T=[];let A=!1;for(let C=1;C<e.length;C++){const P=e[C],D=Array.isArray(x)?x[C-1]:x.type,V=_.parse(P,1+T.length,D);if(!V){A=!0;break}T.push(V)}if(!A)if(Array.isArray(x)&&x.length!==T.length)_.error(`Expected ${x.length} arguments, but found ${T.length} instead.`);else{for(let C=0;C<T.length;C++){const P=Array.isArray(x)?x[C]:x.type,D=T[C];_.concat(C+1).checkSubtype(P,D.type)}if(_.errors.length===0)return new Fi(a,u,b,T)}}if(f.length===1)r.errors.push(..._.errors);else{const x=(f.length?f:d).map(([T])=>{return A=T,Array.isArray(A)?`(${A.map(N).join(", ")})`:`(${N(A.type)}...)`;var A}).join(" | "),b=[];for(let T=1;T<e.length;T++){const A=r.parse(e[T],1+b.length);if(!A)return null;b.push(N(A.type))}r.error(`Expected arguments of type ${x}, but found (${b.join(", ")}) instead.`)}return null}static register(e,r){Fi.definitions=r;for(const a in r)e[a]=Fi}}function Aa(i){if(i instanceof Ia)return Aa(i.boundExpression);if(i instanceof Fi&&i.name==="error"||i instanceof Sa||i instanceof Kr)return!1;const e=i instanceof zr||i instanceof Ri;let r=!0;return i.eachChild(a=>{r=e?r&&Aa(a):r&&a instanceof Hr}),!!r&&Ma(i)&&Ea(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ma(i){if(i instanceof Fi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Kr)return!1;let e=!0;return i.eachChild(r=>{e&&!Ma(r)&&(e=!1)}),e}function Hs(i){if(i instanceof Fi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Hs(r)&&(e=!1)}),e}function Ea(i,e){if(i instanceof Fi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Ea(a,e)&&(r=!1)}),r}function Ss(i,e){const r=i.length-1;let a,o,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),a=i[f],o=i[f+1],a<=e){if(f===r||e<o)return f;u=f+1}else{if(!(a>e))throw new bt("Input is not a number.");d=f-1}return 0}class Lr{constructor(e,r,a){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of a)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(e[1],1,ge);if(!a)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],_=e[d+1],x=d,b=d+1;if(typeof f!="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(o.length&&o[o.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const T=r.parse(_,b,u);if(!T)return null;u=u||T.type,o.push([f,T])}return new Lr(u,a,o)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;return o>=r[u-1]?a[u-1].evaluate(e):a[Ss(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Xe(i,e,r){return i+r*(e-i)}function Ca(i,e,r){return i.map((a,o)=>Xe(a,e[o],r))}const wi={number:Xe,color:function(i,e,r,a="rgb"){switch(a){case"rgb":{const[o,u,d,f]=Ca(i.rgb,e.rgb,r);return new it(o,u,d,f,!1)}case"hcl":{const[o,u,d,f]=i.hcl,[_,x,b,T]=e.hcl;let A,C;if(isNaN(o)||isNaN(_))isNaN(o)?isNaN(_)?A=NaN:(A=_,d!==1&&d!==0||(C=x)):(A=o,b!==1&&b!==0||(C=u));else{let H=_-o;_>o&&H>180?H-=360:_<o&&o-_>180&&(H+=360),A=o+r*H}const[P,D,V,$]=function([H,q,Y,Q]){return H=isNaN(H)?0:H*Oe,ot([Y,Math.cos(H)*q,Math.sin(H)*q,Q])}([A,C??Xe(u,x,r),Xe(d,b,r),Xe(f,T,r)]);return new it(P,D,V,$,!1)}case"lab":{const[o,u,d,f]=ot(Ca(i.lab,e.lab,r));return new it(o,u,d,f,!1)}}},array:Ca,padding:function(i,e,r){return new bi(Ca(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const a=i.values,o=e.values;if(a.length!==o.length)throw new bt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let d=0;d<a.length;d+=2){if(a[d]!==o[d])throw new bt(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${a[d]}, to[${d}]: ${o[d]}`);u.push(a[d]);const[f,_]=a[d+1],[x,b]=o[d+1];u.push([Xe(f,x,r),Xe(_,b,r)])}return new Bi(u)}};class Si{constructor(e,r,a,o,u){this.type=e,this.operator=r,this.interpolation=a,this.input=o,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,a,o){let u=0;if(e.name==="exponential")u=fn(r,e.base,a,o);else if(e.name==="linear")u=fn(r,1,a,o);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new ps(d[0],d[1],d[2],d[3]).solve(fn(r,1,a,o))}return u}static parse(e,r){let[a,o,u,...d]=e;if(!Array.isArray(o)||o.length===0)return r.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const x=o[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:x}}else{if(o[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const x=o.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);o={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ge),!u)return null;const f=[];let _=null;a==="interpolate-hcl"||a==="interpolate-lab"?_=ii:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<d.length;x+=2){const b=d[x],T=d[x+1],A=x+3,C=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.',A);if(f.length&&f[f.length-1][0]>=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const P=r.parse(T,C,_);if(!P)return null;_=_||P.type,f.push([b,P])}return se(_,ge)||se(_,ii)||se(_,I)||se(_,k)||se(_,O(ge))?new Si(_,a,o,u,f):r.error(`Type ${N(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;if(o>=r[u-1])return a[u-1].evaluate(e);const d=Ss(r,o),f=Si.interpolationFactor(this.interpolation,o,r[d],r[d+1]),_=a[d].evaluate(e),x=a[d+1].evaluate(e);switch(this.operator){case"interpolate":return wi[this.type.kind](_,x,f);case"interpolate-hcl":return wi.color(_,x,f,"hcl");case"interpolate-lab":return wi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function fn(i,e,r,a){const o=a-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class Pa{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let a=null;const o=r.expectedType;o&&o.kind!=="value"&&(a=o);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,a,void 0,{typeAnnotation:"omit"});if(!_)return null;a=a||_.type,u.push(_)}if(!a)throw new Error("No output type");const d=o&&u.some(f=>Z(o,f.type));return new Pa(d?Ve:a,u)}evaluate(e){let r,a=null,o=0;for(const u of this.args)if(o++,a=u.evaluate(e),a&&a instanceof qt&&!a.available&&(r||(r=a.name),a=null,o===this.args.length&&(a=r)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ka{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;a.push([d,f])}const o=r.parse(e[e.length-1],e.length-1,r.expectedType,a);return o?new ka(a,o):null}outputDefined(){return this.result.outputDefined()}}class mn{constructor(e,r,a){this.type=e,this.index=r,this.input=a}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,ge),o=r.parse(e[2],2,O(r.expectedType||Ve));return a&&o?new mn(o.type.itemType,a,o):null}evaluate(e){const r=this.index.evaluate(e),a=this.input.evaluate(e);if(r<0)throw new bt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new bt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new bt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class gn{constructor(e,r){this.type=Fe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,Ve);return a&&o?j(a.type,[Fe,Ue,ge,dr,Ve])?new gn(a,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${N(a.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!W(r,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${N(gt(r))} instead.`);if(!W(a,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${N(gt(a))} instead.`);return a.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class za{constructor(e,r,a){this.type=ge,this.needle=e,this.haystack=r,this.fromIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,Ve);if(!a||!o)return null;if(!j(a.type,[Fe,Ue,ge,dr,Ve]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${N(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new za(a,o,u):null}return new za(a,o)}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!W(r,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${N(gt(r))} instead.`);if(!W(a,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${N(gt(a))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return a.indexOf(r,o)}return a.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class _n{constructor(e,r,a,o,u,d){this.inputType=e,this.type=r,this.input=a,this.cases=o,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let a,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},d=[];for(let x=2;x<e.length-1;x+=2){let b=e[x];const T=e[x+1];Array.isArray(b)||(b=[b]);const A=r.concat(x);if(b.length===0)return A.error("Expected at least one branch label.");for(const P of b){if(typeof P!="number"&&typeof P!="string")return A.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return A.error("Numeric branch labels must be integer values.");if(a){if(A.checkSubtype(a,gt(P)))return null}else a=gt(P);if(u[String(P)]!==void 0)return A.error("Branch labels must be unique.");u[String(P)]=d.length}const C=r.parse(T,x,o);if(!C)return null;o=o||C.type,d.push(C)}const f=r.parse(e[1],1,Ve);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,o);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new _n(a,o,f,u,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(gt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class yn{constructor(e,r,a){this.type=e,this.branches=r,this.otherwise=a}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const o=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,Fe);if(!f)return null;const _=r.parse(e[d+1],d+1,a);if(!_)return null;o.push([f,_]),a=a||_.type}const u=r.parse(e[e.length-1],e.length-1,a);if(!u)return null;if(!a)throw new Error("Can't infer output type");return new yn(a,o,u)}evaluate(e){for(const[r,a]of this.branches)if(r.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,a]of this.branches)e(r),e(a);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Da{constructor(e,r,a,o){this.type=e,this.input=r,this.beginIndex=a,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,ge);if(!a||!o)return null;if(!j(a.type,[O(Ve),Ue,Ve]))return r.error(`Expected first argument to be of type array or string, but found ${N(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new Da(a.type,a,o,u):null}return new Da(a.type,a,o)}evaluate(e){const r=this.input.evaluate(e),a=this.beginIndex.evaluate(e);if(!W(r,["string","array"]))throw new bt(`Expected first argument to be of type array or string, but found ${N(gt(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(a,o)}return r.slice(a)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function bo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function wo(i,e,r,a){return a.compare(e,r)===0}function Ts(i,e,r){const a=i!=="=="&&i!=="!=";return class hu{constructor(u,d,f){this.type=Fe,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,Ve);if(!_)return null;if(!bo(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${N(_.type)}'.`);let x=d.parse(u[2],2,Ve);if(!x)return null;if(!bo(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${N(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${N(_.type)}' and '${N(x.type)}'.`);a&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Ri(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ri(_.type,[x])));let b=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,fr),!b)return null}return new hu(_,x,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(a&&this.hasUntypedArgument){const _=gt(d),x=gt(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new bt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const _=gt(d),x=gt(f);if(_.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Il=Ts("==",function(i,e,r){return e===r},wo),Al=Ts("!=",function(i,e,r){return e!==r},function(i,e,r,a){return!wo(0,e,r,a)}),Ml=Ts("<",function(i,e,r){return e<r},function(i,e,r,a){return a.compare(e,r)<0}),El=Ts(">",function(i,e,r){return e>r},function(i,e,r,a){return a.compare(e,r)>0}),Cl=Ts("<=",function(i,e,r){return e<=r},function(i,e,r,a){return a.compare(e,r)<=0}),Pl=Ts(">=",function(i,e,r){return e>=r},function(i,e,r,a){return a.compare(e,r)>=0});class xn{constructor(e,r,a,o,u){this.type=Ue,this.number=e,this.locale=r,this.currency=a,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const a=r.parse(e[1],1,ge);if(!a)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,Ue),!u))return null;let d=null;if(o.currency&&(d=r.parse(o.currency,1,Ue),!d))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,ge),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=r.parse(o["max-fraction-digits"],1,ge),!_)?null:new xn(a,u,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class La{constructor(e){this.type=R,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,ge),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,O(Ue)),!x))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,ii),!b))return null;const T=o[o.length-1];T.scale=_,T.font=x,T.textColor=b}else{const _=r.parse(e[d],1,Ve);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:_,scale:null,font:null,textColor:null})}}return new La(o)}evaluate(e){return new Ht(this.sections.map(r=>{const a=r.content.evaluate(e);return gt(a)===M?new xa("",a,null,null,null):new xa(Je(a),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class vn{constructor(e){this.type=M,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const a=r.parse(e[1],1,Ue);return a?new vn(a):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),a=qt.fromString(r);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(r)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class bn{constructor(e){this.type=ge,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=r.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${N(a.type)} instead.`):new bn(a):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new bt(`Expected value to be of type string or array, but found ${N(gt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Is={"==":Il,"!=":Al,">":El,"<":Ml,">=":Pl,"<=":Cl,array:Ri,at:mn,boolean:Ri,case:yn,coalesce:Pa,collator:Sa,format:La,image:vn,in:gn,"index-of":za,interpolate:Si,"interpolate-hcl":Si,"interpolate-lab":Si,length:bn,let:ka,literal:Hr,match:_n,number:Ri,"number-format":xn,object:Ri,slice:Da,step:Lr,string:Ri,"to-boolean":zr,"to-color":zr,"to-number":zr,"to-string":zr,var:Ia,within:Kr};function So(i,[e,r,a,o]){e=e.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);const u=o?o.evaluate(i):1,d=va(e,r,a,u);if(d)throw new bt(d);return new it(e/255,r/255,a/255,u,!1)}function To(i,e){return i in e}function wn(i,e){const r=e[i];return r===void 0?null:r}function Yr(i){return{type:i}}function Io(i){return{result:"success",value:i}}function Br(i){return{result:"error",value:i}}function As(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ao(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Sn(i){return!!i.expression&&i.expression.interpolated}function Qe(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function _t(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function kl(i){return i}function We(i,e){const r=e.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",o=a||!(a||i.property!==void 0),u=i.type||(Sn(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?it.parse:bi.parse;(i=Qi({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],b(T[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=Ks;else if(u==="interval")f=dt;else if(u==="categorical"){f=yt,_=Object.create(null);for(const b of i.stops)_[b[0]]=b[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Mo}if(a){const b={},T=[];for(let P=0;P<i.stops.length;P++){const D=i.stops[P],V=D[0].zoom;b[V]===void 0&&(b[V]={zoom:V,type:i.type,property:i.property,default:i.default,stops:[]},T.push(V)),b[V].stops.push([D[0].value,D[1]])}const A=[];for(const P of T)A.push([b[P].zoom,We(b[P],e)]);const C={name:"linear"};return{kind:"composite",interpolationType:C,interpolationFactor:Si.interpolationFactor.bind(void 0,C),zoomStops:A.map(P=>P[0]),evaluate:({zoom:P},D)=>Ks({stops:A,base:i.base},e,P).evaluate(P,D)}}if(o){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Si.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>f(i,e,T,_,x)}}return{kind:"source",evaluate(b,T){const A=T&&T.properties?T.properties[i.property]:void 0;return A===void 0?Jr(i.default,e.default):f(i,e,A,_,x)}}}function Jr(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function yt(i,e,r,a,o){return Jr(typeof r===o?a[r]:void 0,i.default,e.default)}function dt(i,e,r){if(Qe(r)!=="number")return Jr(i.default,e.default);const a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];const o=Ss(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Ks(i,e,r){const a=i.base!==void 0?i.base:1;if(Qe(r)!=="number")return Jr(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=Ss(i.stops.map(b=>b[0]),r),d=function(b,T,A,C){const P=C-A,D=b-A;return P===0?0:T===1?D/P:(Math.pow(T,D)-1)/(Math.pow(T,P)-1)}(r,a,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=wi[e.type]||kl;return typeof f.evaluate=="function"?{evaluate(...b){const T=f.evaluate.apply(void 0,b),A=_.evaluate.apply(void 0,b);if(T!==void 0&&A!==void 0)return x(T,A,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function Mo(i,e,r){switch(e.type){case"color":r=it.parse(r);break;case"formatted":r=Ht.fromString(r.toString());break;case"resolvedImage":r=qt.fromString(r.toString());break;case"padding":r=bi.parse(r);break;default:Qe(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Jr(r,i.default,e.default)}Fi.register(Is,{error:[{kind:"error"},[Ue],(i,[e])=>{throw new bt(e.evaluate(i))}],typeof:[Ue,[Ve],(i,[e])=>N(gt(e.evaluate(i)))],"to-rgba":[O(ge,4),[ii],(i,[e])=>{const[r,a,o,u]=e.evaluate(i).rgb;return[255*r,255*a,255*o,u]}],rgb:[ii,[ge,ge,ge],So],rgba:[ii,[ge,ge,ge,ge],So],has:{type:Fe,overloads:[[[Ue],(i,[e])=>To(e.evaluate(i),i.properties())],[[Ue,er],(i,[e,r])=>To(e.evaluate(i),r.evaluate(i))]]},get:{type:Ve,overloads:[[[Ue],(i,[e])=>wn(e.evaluate(i),i.properties())],[[Ue,er],(i,[e,r])=>wn(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ve,[Ue],(i,[e])=>wn(e.evaluate(i),i.featureState||{})],properties:[er,[],i=>i.properties()],"geometry-type":[Ue,[],i=>i.geometryType()],id:[Ve,[],i=>i.id()],zoom:[ge,[],i=>i.globals.zoom],"heatmap-density":[ge,[],i=>i.globals.heatmapDensity||0],"line-progress":[ge,[],i=>i.globals.lineProgress||0],accumulated:[Ve,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ge,Yr(ge),(i,e)=>{let r=0;for(const a of e)r+=a.evaluate(i);return r}],"*":[ge,Yr(ge),(i,e)=>{let r=1;for(const a of e)r*=a.evaluate(i);return r}],"-":{type:ge,overloads:[[[ge,ge],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ge],(i,[e])=>-e.evaluate(i)]]},"/":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ge,[ge],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))],log2:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ge,[ge],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ge,[ge],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ge,[ge],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ge,[ge],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ge,[ge],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ge,[ge],(i,[e])=>Math.atan(e.evaluate(i))],min:[ge,Yr(ge),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ge,Yr(ge),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ge,[ge],(i,[e])=>Math.abs(e.evaluate(i))],round:[ge,[ge],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ge,[ge],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Fe,[Ue,Ve],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Fe,[Ve],(i,[e])=>i.id()===e.value],"filter-type-==":[Fe,[Ue],(i,[e])=>i.geometryType()===e.value],"filter-<":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<o}],"filter-id-<":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<a}],"filter->":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>o}],"filter-id->":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>a}],"filter-<=":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<=a}],"filter->=":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>=a}],"filter-has":[Fe,[Ve],(i,[e])=>e.value in i.properties()],"filter-has-id":[Fe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Fe,[O(Ue)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Fe,[O(Ve)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Fe,[Ue,O(Ve)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Fe,[Ue,O(Ve)],(i,[e,r])=>function(a,o,u,d){for(;u<=d;){const f=u+d>>1;if(o[f]===a)return!0;o[f]>a?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Yr(Fe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Yr(Fe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Fe,[Fe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Fe,[Ue],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ue,[Ue],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ue,[Ue],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ue,Yr(Ve),(i,e)=>e.map(r=>Je(r.evaluate(i))).join("")],"resolved-locale":[Ue,[fr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Tn{constructor(e,r){var a;this.expression=e,this._warningHistory={},this._evaluator=new ln,this._defaultValue=r?(a=r).type==="color"&&_t(a.default)?new it(0,0,0,0):a.type==="color"?it.parse(a.default)||null:a.type==="padding"?bi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Bi.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,a,o,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new bt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ba(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Is}function Ra(i,e){const r=new wa(Is,Aa,[],e?function(o){const u={color:ii,string:Ue,number:ge,enum:Ue,boolean:Fe,formatted:R,padding:I,resolvedImage:M,variableAnchorOffsetCollection:k};return o.type==="array"?O(u[o.value]||Ve,o.length):u[o.type]}(e):void 0),a=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Io(new Tn(a,e)):Br(r.errors)}class In{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Hs(r.expression)}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}}class Fa{constructor(e,r,a,o){this.kind=e,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Hs(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}interpolationFactor(e,r,a){return this.interpolationType?Si.interpolationFactor(this.interpolationType,e,r,a):0}}function An(i,e){const r=Ra(i,e);if(r.result==="error")return r;const a=r.value.expression,o=Ma(a);if(!o&&!As(e))return Br([new vt("","data expressions not supported")]);const u=Ea(a,["zoom"]);if(!u&&!Ao(e))return Br([new vt("","zoom expressions not supported")]);const d=Js(a);return d||u?d instanceof vt?Br([d]):d instanceof Si&&!Sn(e)?Br([new vt("",'"interpolate" expressions cannot be used with this property')]):Io(d?new Fa(o?"camera":"composite",r.value,d.labels,d instanceof Si?d.interpolation:void 0):new In(o?"constant":"source",r.value)):Br([new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ys{constructor(e,r){this._parameters=e,this._specification=r,Qi(this,We(this._parameters,this._specification))}static deserialize(e){return new Ys(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Js(i){let e=null;if(i instanceof ka)e=Js(i.result);else if(i instanceof Pa){for(const r of i.args)if(e=Js(r),e)break}else(i instanceof Lr||i instanceof Si)&&i.input instanceof Fi&&i.input.name==="zoom"&&(e=i);return e instanceof vt||i.eachChild(r=>{const a=Js(r);a instanceof vt?e=a:!e&&a?e=new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new vt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Qs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Qs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const zl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Mn(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Qs(i)||(i=Oa(i));const e=Ra(i,zl);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,o)=>e.value.evaluate(r,a,{},o),needGeometry:Eo(i)}}function Dl(i,e){return i<e?-1:i>e?1:0}function Eo(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Eo(i[e]))return!0;return!1}function Oa(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?En(i[1],i[2],"=="):e==="!="?ea(En(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?En(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Oa))):e==="all"?["all"].concat(i.slice(1).map(Oa)):e==="none"?["all"].concat(i.slice(1).map(Oa).map(ea)):e==="in"?Co(i[1],i.slice(2)):e==="!in"?ea(Co(i[1],i.slice(2))):e==="has"?Po(i[1]):e==="!has"?ea(Po(i[1])):e!=="within"||i;var r}function En(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Co(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Dl)]]:["filter-in-small",i,["literal",e]]}}function Po(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function ea(i){return["!",i]}function Va(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${Va(u)},`;return`${o}]`}const r=Object.keys(i).sort();let a="{";for(let o=0;o<r.length;o++)a+=`${JSON.stringify(r[o])}:${Va(i[r[o]])},`;return`${a}}`}function Na(i){let e="";for(const r of ui)e+=`/${Va(i[r])}`;return e}function ko(i){const e=i.value;return e?[new fe(i.key,e,"constants have been deprecated as of v8")]:[]}function wt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Qr(i){if(Array.isArray(i))return i.map(Qr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Qr(i[r]);return e}return wt(i)}function pi(i){const e=i.key,r=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let _=[];const x=Qe(r);if(x!=="object")return[new fe(e,r,`object expected, ${x} found`)];for(const b in r){const T=b.split(".")[0],A=a[T]||a["*"];let C;if(o[T])C=o[T];else if(a[T])C=f;else if(o["*"])C=o["*"];else{if(!a["*"]){_.push(new fe(e,r[b],`unknown property "${b}"`));continue}C=f}_=_.concat(C({key:(e&&`${e}.`)+b,value:r[b],valueSpec:A,style:u,styleSpec:d,object:r,objectKey:b,validateSpec:f},r))}for(const b in a)o[b]||a[b].required&&a[b].default===void 0&&r[b]===void 0&&_.push(new fe(e,r,`missing required property "${b}"`));return _}function Ms(i){const e=i.value,r=i.valueSpec,a=i.style,o=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(Qe(e)!=="array")return[new fe(u,e,`array expected, ${Qe(e)} found`)];if(r.length&&e.length!==r.length)return[new fe(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new fe(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};o.$version<7&&(f.function=r.function),Qe(r.value)==="object"&&(f=r.value);let _=[];for(let x=0;x<e.length;x++)_=_.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:a,styleSpec:o,key:`${u}[${x}]`}));return _}function ta(i){const e=i.key,r=i.value,a=i.valueSpec;let o=Qe(r);return o==="number"&&r!=r&&(o="NaN"),o!=="number"?[new fe(e,r,`number expected, ${o} found`)]:"minimum"in a&&r<a.minimum?[new fe(e,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new fe(e,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function Ua(i){const e=i.valueSpec,r=wt(i.value.type);let a,o,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=Qe(i.value.stops)==="array"&&Qe(i.value.stops[0])==="array"&&Qe(i.value.stops[0][0])==="object",b=pi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(C){if(r==="identity")return[new fe(C.key,C.value,'identity function may not have a "stops" property')];let P=[];const D=C.value;return P=P.concat(Ms({key:C.key,value:D,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:T})),Qe(D)==="array"&&D.length===0&&P.push(new fe(C.key,D,"array must have at least one stop")),P},default:function(C){return C.validateSpec({key:C.key,value:C.value,valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec})}}});return r==="identity"&&f&&b.push(new fe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new fe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Sn(i.valueSpec)&&b.push(new fe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!As(i.valueSpec)?b.push(new fe(i.key,i.value,"property functions not supported")):f&&!Ao(i.valueSpec)&&b.push(new fe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||b.push(new fe(i.key,i.value,'"property" property is required')),b;function T(C){let P=[];const D=C.value,V=C.key;if(Qe(D)!=="array")return[new fe(V,D,`array expected, ${Qe(D)} found`)];if(D.length!==2)return[new fe(V,D,`array length 2 expected, length ${D.length} found`)];if(x){if(Qe(D[0])!=="object")return[new fe(V,D,`object expected, ${Qe(D[0])} found`)];if(D[0].zoom===void 0)return[new fe(V,D,"object stop key must have zoom")];if(D[0].value===void 0)return[new fe(V,D,"object stop key must have value")];if(u&&u>wt(D[0].zoom))return[new fe(V,D[0].zoom,"stop zoom values must appear in ascending order")];wt(D[0].zoom)!==u&&(u=wt(D[0].zoom),o=void 0,d={}),P=P.concat(pi({key:`${V}[0]`,value:D[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:ta,value:A}}))}else P=P.concat(A({key:`${V}[0]`,value:D[0],valueSpec:{},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},D));return Ba(Qr(D[1]))?P.concat([new fe(`${V}[1]`,D[1],"expressions are not allowed in function stops.")]):P.concat(C.validateSpec({key:`${V}[1]`,value:D[1],valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec}))}function A(C,P){const D=Qe(C.value),V=wt(C.value),$=C.value!==null?C.value:P;if(a){if(D!==a)return[new fe(C.key,$,`${D} stop domain type must match previous stop domain type ${a}`)]}else a=D;if(D!=="number"&&D!=="string"&&D!=="boolean")return[new fe(C.key,$,"stop domain value must be a number, string, or boolean")];if(D!=="number"&&r!=="categorical"){let H=`number expected, ${D} found`;return As(e)&&r===void 0&&(H+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new fe(C.key,$,H)]}return r!=="categorical"||D!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&D==="number"&&o!==void 0&&V<o?[new fe(C.key,$,"stop domain values must appear in ascending order")]:(o=V,r==="categorical"&&V in d?[new fe(C.key,$,"stop domain values must be unique")]:(d[V]=!0,[])):[new fe(C.key,$,`integer expected, found ${V}`)]}}function es(i){const e=(i.expressionContext==="property"?An:Ra)(Qr(i.value),i.valueSpec);if(e.result==="error")return e.value.map(a=>new fe(`${i.key}${a.key}`,i.value,a.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new fe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Hs(r))return[new fe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Hs(r))return[new fe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ea(r,["zoom","feature-state"]))return[new fe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ma(r))return[new fe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ia(i){const e=i.key,r=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?a.values.indexOf(wt(r))===-1&&o.push(new fe(e,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(wt(r))===-1&&o.push(new fe(e,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function Es(i){return Qs(Qr(i.value))?es(Qi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zo(i)}function zo(i){const e=i.value,r=i.key;if(Qe(e)!=="array")return[new fe(r,e,`array expected, ${Qe(e)} found`)];const a=i.styleSpec;let o,u=[];if(e.length<1)return[new fe(r,e,"filter array must have at least 1 element")];switch(u=u.concat(ia({key:`${r}[0]`,value:e[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),wt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&wt(e[1])==="$type"&&u.push(new fe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new fe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Qe(e[1]),o!=="string"&&u.push(new fe(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let d=2;d<e.length;d++)o=Qe(e[d]),wt(e[1])==="$type"?u=u.concat(ia({key:`${r}[${d}]`,value:e[d],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new fe(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat(zo({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":o=Qe(e[1]),e.length!==2?u.push(new fe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new fe(`${r}[1]`,e[1],`string expected, ${o} found`));break;case"within":o=Qe(e[1]),e.length!==2?u.push(new fe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="object"&&u.push(new fe(`${r}[1]`,e[1],`object expected, ${o} found`))}return u}function Do(i,e){const r=i.key,a=i.validateSpec,o=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,_=u[`${e}_${i.layerType}`];if(!_)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return a({key:r,value:d,valueSpec:u.transition,style:o,styleSpec:u});const b=i.valueSpec||_[f];if(!b)return[new fe(r,d,`unknown property "${f}"`)];let T;if(Qe(d)==="string"&&As(b)&&!b.tokens&&(T=/^{([^}]+)}$/.exec(d)))return[new fe(r,d,`"${f}" does not support interpolation syntax
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const lu=require("./index.cjs59.js"),cu=require("./index.cjs60.js");function ld(an,vl){for(var Ur=0;Ur<vl.length;Ur++){const cr=vl[Ur];if(typeof cr!="string"&&!Array.isArray(cr)){for(const $r in cr)if($r!=="default"&&!($r in an)){const Ns=Object.getOwnPropertyDescriptor(cr,$r);Ns&&Object.defineProperty(an,$r,Ns.get?Ns:{enumerable:!0,get:()=>cr[$r]})}}}return Object.freeze(Object.defineProperty(an,Symbol.toStringTag,{value:"Module"}))}(function(an,vl){(function(Ur,cr){an.exports=cr()})(lu.commonjsGlobal,function(){var Ur,cr,$r;function Ns(c,Wi){if(!Ur)Ur=Wi;else if(!cr)cr=Wi;else{var ie="var sharedChunk = {}; ("+Ur+")(sharedChunk); ("+cr+")(sharedChunk);",Hi={};Ur(Hi),$r=Wi(Hi),typeof window<"u"&&($r.workerUrl=window.URL.createObjectURL(new Blob([ie],{type:"text/javascript"})))}}Ns(["exports"],function(c){function Wi(i,e,r,a){return new(r||(r=Promise))(function(o,u){function d(x){try{_(a.next(x))}catch(b){u(b)}}function f(x){try{_(a.throw(x))}catch(b){u(b)}}function _(x){var b;x.done?o(x.value):(b=x.value,b instanceof r?b:new r(function(T){T(b)})).then(d,f)}_((a=a.apply(i,e||[])).next())})}function ie(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Hi=ci;function ci(i,e){this.x=i,this.y=e}ci.prototype={clone:function(){return new ci(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),o=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ci.convert=function(i){return i instanceof ci?i:Array.isArray(i)?new ci(i[0],i[1]):i};var Be=ie(Hi),us=Us;function Us(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}Us.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=o/u}var d=0,f=1;for(r=i,a=0;a<20&&(o=this.sampleCurveX(r),!(Math.abs(o-i)<e));a++)i>o?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var ps=ie(us);let ei,Pt;function ma(){return ei==null&&(ei=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ei}function Ir(){if(Pt==null&&(Pt=!1,ma())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<5*5;a++){const o=4*a;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){Pt=!0;break}}}return Pt||!1}function $s(i,e,r,a){const o=new ps(i,e,r,a);return function(u){return o.solve(u)}}const ds=$s(.25,.1,.25,1);function Ki(i,e,r){return Math.min(r,Math.max(e,i))}function js(i,e,r){const a=r-e,o=((i-e)%a+a)%a+e;return o===e?r:o}function $t(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}let ga=1;function mt(i,e,r){const a={};for(const o in i)a[o]=e.call(r||this,i[o],o,i);return a}function fs(i,e,r){const a={};for(const o in i)e.call(r||this,i[o],o,i)&&(a[o]=i[o]);return a}function $i(i){return Array.isArray(i)?i.map($i):typeof i=="object"&&i?mt(i,$i):i}const Ar={};function ti(i){Ar[i]||(typeof console<"u"&&console.warn(i),Ar[i]=!0)}function vi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function hr(i){let e=0;for(let r,a,o=0,u=i.length,d=u-1;o<u;d=o++)r=i[o],a=i[d],e+=(a.x-r.x)*(r.y+a.y);return e}function ki(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let jr=null;function qs(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const _a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Zs(i,e,r,a,o){return Wi(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u==null?void 0:u.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(a*o*4);if(yield u.copyTo(_,function(x,b,T,A,C){const P=4*Math.max(-b,0),D=(Math.max(0,T)-T)*A*4+P,V=4*A,$=Math.max(0,b),H=Math.max(0,T);return{rect:{x:$,y:H,width:Math.min(x.width,b+A)-$,height:Math.min(x.height,T+C)-H},layout:[{offset:D,stride:V}]}}(i,e,r,a,o)),f)for(let x=0;x<_.length;x+=4){const b=_[x];_[x]=_[x+2],_[x+2]=b}return _}finally{u.close()}})}let Yi,ct,hi,qr;const ms={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(hi||(hi=document.createElement("a")),hi.href=i,hi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(qr==null&&(qr=matchMedia("(prefers-reduced-motion: reduce)")),qr.matches)}},gs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Mr extends Error{constructor(e,r,a,o){super(`AJAXError: ${r} (${e}): ${a}`),this.status=e,this.statusText=r,this.url=a,this.body=o}}const ji=ki()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,zi=i=>gs.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function Gs(i,e){const r=new AbortController,a=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:ji(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&a.headers.set("Accept","application/json"),u||fetch(a).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(_=>{u||(o=!0,e(null,_,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(_=>{u||e(new Error(_.message))})})(d):d.blob().then(f=>e(new Mr(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const Er=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(ki()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!ki())return(zi(i.url)||Gs)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ji())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Gs(i,e);if(ki()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(a,o){const u=new XMLHttpRequest;u.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(u.responseType="arraybuffer");for(const d in a.headers)u.setRequestHeader(d,a.headers[d]);return a.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=a.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(a.type==="json")try{d=JSON.parse(u.response)}catch(f){return o(f)}o(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new Mr(u.status,u.statusText,a.url,d))}},u.send(a.body),{cancel:()=>u.abort()}}(i,e)},Xs=function(i,e){return Er($t(i,{type:"arrayBuffer"}),e)};function ur(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function _s(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Zr(i,e,r){if(r&&r[i]){const a=r[i].indexOf(e);a!==-1&&r[i].splice(a,1)}}class Cr{constructor(e,r={}){$t(this,r),this.type=e}}class Pr extends Cr{constructor(e,r={}){super("error",$t({error:e},r))}}class Gr{on(e,r){return this._listeners=this._listeners||{},_s(e,r,this._listeners),this}off(e,r){return Zr(e,r,this._listeners),Zr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},_s(e,r,this._oneTimeListeners),this):new Promise(a=>this.once(e,a))}fire(e,r){typeof e=="string"&&(e=new Cr(e,r||{}));const a=e.type;if(this.listens(a)){e.target=this;const o=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const f of u)Zr(a,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&($t(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Pr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var re={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},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:{},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_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"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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 ui=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Di(i,e){const r={};for(const a in i)a!=="ref"&&(r[a]=i[a]);return ui.forEach(a=>{a in e&&(r[a]=e[a])}),r}function nt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!nt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!nt(i[r],e[r]))return!1;return!0}return i===e}const Ye={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Ji(i,e,r){r.push({command:Ye.addSource,args:[i,e[i]]})}function ys(i,e,r){e.push({command:Ye.removeSource,args:[i]}),r[i]=!0}function pr(i,e,r,a){ys(i,r,a),Ji(i,e,r)}function ya(i,e,r){let a;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&a!=="data"&&!nt(i[r][a],e[r][a]))return!1;for(a in e[r])if(Object.prototype.hasOwnProperty.call(e[r],a)&&a!=="data"&&!nt(i[r][a],e[r][a]))return!1;return!0}function xs(i,e,r,a,o,u){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(nt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(nt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}))}function kr(i){return i.id}function Xr(i,e){return i[e.id]=e,i}class fe{constructor(e,r,a,o){this.message=(e?`${e}: `:"")+a,o&&(this.identifier=o),r!=null&&r.__line__&&(this.line=r.__line__)}}function Qi(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}class vt extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Wr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[a,o]of r)this.bindings[a]=o}concat(e){return new Wr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const dr={kind:"null"},ge={kind:"number"},Ue={kind:"string"},Fe={kind:"boolean"},ii={kind:"color"},er={kind:"object"},Ve={kind:"value"},fr={kind:"collator"},R={kind:"formatted"},I={kind:"padding"},M={kind:"resolvedImage"},k={kind:"variableAnchorOffsetCollection"};function O(i,e){return{kind:"array",itemType:i,N:e}}function N(i){if(i.kind==="array"){const e=N(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const K=[dr,ge,Ue,Fe,ii,R,er,O(Ve),I,M,k];function Z(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Z(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of K)if(!Z(r,e))return null}}return`Expected ${N(i)} but found ${N(e)} instead.`}function j(i,e){return e.some(r=>r.kind===i.kind)}function W(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function se(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const ae=.96422,le=.82521,Pe=4/29,Re=6/29,Te=3*Re*Re,ze=Re*Re*Re,Oe=Math.PI/180,tt=180/Math.PI;function st(i){return(i%=360)<0&&(i+=360),i}function Ke([i,e,r,a]){let o,u;const d=Wt((.2225045*(i=He(i))+.7168786*(e=He(e))+.0606169*(r=He(r)))/1);i===e&&e===r?o=u=d:(o=Wt((.4360747*i+.3850649*e+.1430804*r)/ae),u=Wt((.0139322*i+.0971045*e+.7141733*r)/le));const f=116*d-16;return[f<0?0:f,500*(o-d),200*(d-u),a]}function He(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Wt(i){return i>ze?Math.pow(i,1/3):i/Te+Pe}function ot([i,e,r,a]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,d=isNaN(r)?o:o-r/200;return o=1*jt(o),u=ae*jt(u),d=le*jt(d),[kt(3.1338561*u-1.6168667*o-.4906146*d),kt(-.9787684*u+1.9161415*o+.033454*d),kt(.0719453*u-.2289914*o+1.4052427*d),a]}function kt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function jt(i){return i>Re?i*i*i:Te*(i-Pe)}function Li(i){return parseInt(i.padEnd(2,i),16)/255}function po(i,e){return vs(e?i/100:i,0,1)}function vs(i,e,r){return Math.min(Math.max(e,i),r)}function bs(i){return!i.some(Number.isNaN)}const bl={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]};class it{constructor(e,r,a,o=1,u=!0){this.r=e,this.g=r,this.b=a,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,a,o]))}static parse(e){if(e instanceof it)return e;if(typeof e!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=bl[a];if(o){const[d,f,_]=o;return[d/255,f/255,_/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const d=a.length<6?1:2;let f=1;return[Li(a.slice(f,f+=d)),Li(a.slice(f,f+=d)),Li(a.slice(f,f+=d)),Li(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){const d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,x,b,T,A,C,P,D,V,$,H]=d,q=[b||" ",C||" ",V].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const Y=[x,A,D].join(""),Q=Y==="%%%"?100:Y===""?255:0;if(Q){const oe=[vs(+_/Q,0,1),vs(+T/Q,0,1),vs(+P/Q,0,1),$?po(+$,H):1];if(bs(oe))return oe}}return}}const u=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,x,b,T,A,C,P]=u,D=[_||" ",b||" ",A].join("");if(D===" "||D===" /"||D===",,"||D===",,,"){const V=[+f,vs(+x,0,100),vs(+T,0,100),C?po(+C,P):1];if(bs(V))return function([$,H,q,Y]){function Q(oe){const be=(oe+$/30)%12,Ae=H*Math.min(q,1-q);return q-Ae*Math.max(-1,Math.min(be-3,9-be,1))}return $=st($),H/=100,q/=100,[Q(0),Q(8),Q(4),Y]}(V)}}}(e);return r?new it(...r,!1):void 0}get rgb(){const{r:e,g:r,b:a,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,a/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,a,o,u]=Ke(e),d=Math.sqrt(a*a+o*o);return[Math.round(1e4*d)?st(Math.atan2(o,a)*tt):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ke(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,a,o]=this.rgb;return`rgba(${[e,r,a].map(u=>Math.round(255*u)).join(",")},${o})`}}it.black=new it(0,0,0,1),it.white=new it(1,1,1,1),it.transparent=new it(0,0,0,0),it.red=new it(1,0,0,1);class nn{constructor(e,r,a){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class xa{constructor(e,r,a,o,u){this.text=e,this.image=r,this.scale=a,this.fontStack=o,this.textColor=u}}class Ht{constructor(e){this.sections=e}static fromString(e){return new Ht([new xa(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ht?e:Ht.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bi)return e;if(typeof e=="number")return new bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new bi(e)}}toString(){return JSON.stringify(this.values)}}const wl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const a=e[r],o=e[r+1];if(typeof a!="string"||!wl.has(a)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Bi(e)}}toString(){return JSON.stringify(this.values)}}class qt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new qt({name:e,available:!1}):null}}function va(i,e,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,e,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,e,r,a]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ws(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof it||i instanceof nn||i instanceof Ht||i instanceof bi||i instanceof Bi||i instanceof qt)return!0;if(Array.isArray(i)){for(const e of i)if(!ws(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ws(i[e]))return!1;return!0}return!1}function gt(i){if(i===null)return dr;if(typeof i=="string")return Ue;if(typeof i=="boolean")return Fe;if(typeof i=="number")return ge;if(i instanceof it)return ii;if(i instanceof nn)return fr;if(i instanceof Ht)return R;if(i instanceof bi)return I;if(i instanceof Bi)return k;if(i instanceof qt)return M;if(Array.isArray(i)){const e=i.length;let r;for(const a of i){const o=gt(a);if(r){if(r===o)continue;r=Ve;break}r=o}return O(r||Ve,e)}return er}function Je(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof it||i instanceof Ht||i instanceof bi||i instanceof Bi||i instanceof qt?i.toString():JSON.stringify(i)}class Hr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ws(e[1]))return r.error("invalid value");const a=e[1];let o=gt(a);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new Hr(o,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class bt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ba={string:Ue,number:ge,boolean:Fe,object:er};class Ri{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let a,o=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in ba)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=ba[x],o++}else f=Ve;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],o++}a=O(f,_)}else{if(!ba[u])throw new Error(`Types doesn't contain name = ${u}`);a=ba[u]}const d=[];for(;o<e.length;o++){const f=r.parse(e[o],o,Ve);if(!f)return null;d.push(f)}return new Ri(a,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(e);if(!Z(this.type,gt(a)))return a;if(r===this.args.length-1)throw new bt(`Expected value to be of type ${N(this.type)}, but found ${N(gt(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const on={"to-boolean":Fe,"to-color":ii,"to-number":ge,"to-string":Ue};class zr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[0];if(!on[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=on[a],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,Ve);if(!f)return null;u.push(f)}return new zr(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,a;for(const o of this.args){if(r=o.evaluate(e),a=null,r instanceof it)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:va(r[0],r[1],r[2],r[3]),!a))return new it(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new bt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(e);const o=bi.parse(r);if(o)return o}throw new bt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(e);const o=Bi.parse(r);if(o)return o}throw new bt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new bt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ht.fromString(Je(this.args[0].evaluate(e)));case"resolvedImage":return qt.fromString(Je(this.args[0].evaluate(e)));default:return Je(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const fo=["Unknown","Point","LineString","Polygon"];class ln{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?fo[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=it.parse(e)),r}}class wa{constructor(e,r,a=[],o,u=new Wr,d=[]){this.registry=e,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=o,this._isConstant=r}parse(e,r,a,o,u={}){return r?this.concat(r,a,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function a(o,u,d){return d==="assert"?new Ri(u,[o]):d==="coerce"?new zr(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Hr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new ln;try{d=new Hr(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,a){const o=typeof e=="number"?this.path.concat(e):this.path,u=a?this.scope.concat(a):this.scope;return new wa(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const a=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new vt(a,e))}checkSubtype(e,r){const a=Z(e,r);return a&&this.error(a),a}}class Sa{constructor(e,r,a){this.type=fr,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const o=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Fe);if(!o)return null;const u=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Fe);if(!u)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,Ue),!d)?null:new Sa(o,u,d)}evaluate(e){return new nn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Dr=8192;function cn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ws(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function mo(i,e){const r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*Dr),Math.round(a*o*Dr)]}function Sl(i,e,r){const a=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return a*d-u*o==0&&a*u<=0&&o*d<=0}function hn(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const _=e[d];for(let x=0,b=_.length;x<b-1;x++){if(Sl(i,_[x],_[x+1]))return!1;(o=_[x])[1]>(a=i)[1]!=(u=_[x+1])[1]>a[1]&&a[0]<(u[0]-o[0])*(a[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var a,o,u;return r}function un(i,e){for(let r=0;r<e.length;r++)if(hn(i,e[r]))return!0;return!1}function go(i,e,r,a){const o=a[0]-r[0],u=a[1]-r[1],d=(i[0]-r[0])*u-o*(i[1]-r[1]),f=(e[0]-r[0])*u-o*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Tl(i,e,r){for(const x of r)for(let b=0;b<x.length-1;++b)if((f=[(d=x[b+1])[0]-(u=x[b])[0],d[1]-u[1]])[0]*(_=[(o=e)[0]-(a=i)[0],o[1]-a[1]])[1]-f[1]*_[0]!=0&&go(a,o,u,d)&&go(u,d,a,o))return!0;var a,o,u,d,f,_;return!1}function _o(i,e){for(let r=0;r<i.length;++r)if(!hn(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Tl(i[r],i[r+1],e))return!1;return!0}function yo(i,e){for(let r=0;r<e.length;r++)if(_o(i,e[r]))return!0;return!1}function Ta(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=[];for(let d=0;d<i[o].length;d++){const f=mo(i[o][d],r);cn(e,f),u.push(f)}a.push(u)}return a}function xo(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=Ta(i[o],e,r);a.push(u)}return a}function vo(i,e,r,a){if(i[0]<r[0]||i[0]>r[2]){const o=.5*a;let u=i[0]-r[0]>o?-a:r[0]-i[0]>o?a:0;u===0&&(u=i[0]-r[2]>o?-a:r[2]-i[0]>o?a:0),i[0]+=u}cn(e,i)}function pn(i,e,r,a){const o=Math.pow(2,a.z)*Dr,u=[a.x*Dr,a.y*Dr],d=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];vo(x,e,r,o),d.push(x)}return d}function dn(i,e,r,a){const o=Math.pow(2,a.z)*Dr,u=[a.x*Dr,a.y*Dr],d=[];for(const _ of i){const x=[];for(const b of _){const T=[b.x+u[0],b.y+u[1]];cn(e,T),x.push(T)}d.push(x)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const x of _)vo(x,e,r,o)}var f;return d}class Kr{constructor(e,r){this.type=Fe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ws(e[1])){const a=e[1];if(a.type==="FeatureCollection")for(let o=0;o<a.features.length;++o){const u=a.features[o].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Kr(a,a.features[o].geometry)}else if(a.type==="Feature"){const o=a.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Kr(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Kr(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=Ta(a.coordinates,u,d),_=pn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!hn(x,f))return!1}if(a.type==="MultiPolygon"){const f=xo(a.coordinates,u,d),_=pn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!un(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=Ta(a.coordinates,u,d),_=dn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!_o(x,f))return!1}if(a.type==="MultiPolygon"){const f=xo(a.coordinates,u,d),_=dn(r.geometry(),o,u,d);if(!Ws(o,u))return!1;for(const x of _)if(!yo(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ia{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=e[1];return r.scope.has(a)?new Ia(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Fi{constructor(e,r,a,o){this.name=e,this.type=r,this._evaluate=a,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const a=e[0],o=Fi.definitions[a];if(!o)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,d=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,b]of f){_=new wa(r.registry,Aa,r.path,null,r.scope);const T=[];let A=!1;for(let C=1;C<e.length;C++){const P=e[C],D=Array.isArray(x)?x[C-1]:x.type,V=_.parse(P,1+T.length,D);if(!V){A=!0;break}T.push(V)}if(!A)if(Array.isArray(x)&&x.length!==T.length)_.error(`Expected ${x.length} arguments, but found ${T.length} instead.`);else{for(let C=0;C<T.length;C++){const P=Array.isArray(x)?x[C]:x.type,D=T[C];_.concat(C+1).checkSubtype(P,D.type)}if(_.errors.length===0)return new Fi(a,u,b,T)}}if(f.length===1)r.errors.push(..._.errors);else{const x=(f.length?f:d).map(([T])=>{return A=T,Array.isArray(A)?`(${A.map(N).join(", ")})`:`(${N(A.type)}...)`;var A}).join(" | "),b=[];for(let T=1;T<e.length;T++){const A=r.parse(e[T],1+b.length);if(!A)return null;b.push(N(A.type))}r.error(`Expected arguments of type ${x}, but found (${b.join(", ")}) instead.`)}return null}static register(e,r){Fi.definitions=r;for(const a in r)e[a]=Fi}}function Aa(i){if(i instanceof Ia)return Aa(i.boundExpression);if(i instanceof Fi&&i.name==="error"||i instanceof Sa||i instanceof Kr)return!1;const e=i instanceof zr||i instanceof Ri;let r=!0;return i.eachChild(a=>{r=e?r&&Aa(a):r&&a instanceof Hr}),!!r&&Ma(i)&&Ea(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ma(i){if(i instanceof Fi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Kr)return!1;let e=!0;return i.eachChild(r=>{e&&!Ma(r)&&(e=!1)}),e}function Hs(i){if(i instanceof Fi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Hs(r)&&(e=!1)}),e}function Ea(i,e){if(i instanceof Fi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Ea(a,e)&&(r=!1)}),r}function Ss(i,e){const r=i.length-1;let a,o,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),a=i[f],o=i[f+1],a<=e){if(f===r||e<o)return f;u=f+1}else{if(!(a>e))throw new bt("Input is not a number.");d=f-1}return 0}class Lr{constructor(e,r,a){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of a)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(e[1],1,ge);if(!a)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],_=e[d+1],x=d,b=d+1;if(typeof f!="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(o.length&&o[o.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const T=r.parse(_,b,u);if(!T)return null;u=u||T.type,o.push([f,T])}return new Lr(u,a,o)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;return o>=r[u-1]?a[u-1].evaluate(e):a[Ss(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Xe(i,e,r){return i+r*(e-i)}function Ca(i,e,r){return i.map((a,o)=>Xe(a,e[o],r))}const wi={number:Xe,color:function(i,e,r,a="rgb"){switch(a){case"rgb":{const[o,u,d,f]=Ca(i.rgb,e.rgb,r);return new it(o,u,d,f,!1)}case"hcl":{const[o,u,d,f]=i.hcl,[_,x,b,T]=e.hcl;let A,C;if(isNaN(o)||isNaN(_))isNaN(o)?isNaN(_)?A=NaN:(A=_,d!==1&&d!==0||(C=x)):(A=o,b!==1&&b!==0||(C=u));else{let H=_-o;_>o&&H>180?H-=360:_<o&&o-_>180&&(H+=360),A=o+r*H}const[P,D,V,$]=function([H,q,Y,Q]){return H=isNaN(H)?0:H*Oe,ot([Y,Math.cos(H)*q,Math.sin(H)*q,Q])}([A,C??Xe(u,x,r),Xe(d,b,r),Xe(f,T,r)]);return new it(P,D,V,$,!1)}case"lab":{const[o,u,d,f]=ot(Ca(i.lab,e.lab,r));return new it(o,u,d,f,!1)}}},array:Ca,padding:function(i,e,r){return new bi(Ca(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const a=i.values,o=e.values;if(a.length!==o.length)throw new bt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let d=0;d<a.length;d+=2){if(a[d]!==o[d])throw new bt(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${a[d]}, to[${d}]: ${o[d]}`);u.push(a[d]);const[f,_]=a[d+1],[x,b]=o[d+1];u.push([Xe(f,x,r),Xe(_,b,r)])}return new Bi(u)}};class Si{constructor(e,r,a,o,u){this.type=e,this.operator=r,this.interpolation=a,this.input=o,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,a,o){let u=0;if(e.name==="exponential")u=fn(r,e.base,a,o);else if(e.name==="linear")u=fn(r,1,a,o);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new ps(d[0],d[1],d[2],d[3]).solve(fn(r,1,a,o))}return u}static parse(e,r){let[a,o,u,...d]=e;if(!Array.isArray(o)||o.length===0)return r.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const x=o[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:x}}else{if(o[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const x=o.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);o={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ge),!u)return null;const f=[];let _=null;a==="interpolate-hcl"||a==="interpolate-lab"?_=ii:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<d.length;x+=2){const b=d[x],T=d[x+1],A=x+3,C=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.',A);if(f.length&&f[f.length-1][0]>=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const P=r.parse(T,C,_);if(!P)return null;_=_||P.type,f.push([b,P])}return se(_,ge)||se(_,ii)||se(_,I)||se(_,k)||se(_,O(ge))?new Si(_,a,o,u,f):r.error(`Type ${N(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;if(o>=r[u-1])return a[u-1].evaluate(e);const d=Ss(r,o),f=Si.interpolationFactor(this.interpolation,o,r[d],r[d+1]),_=a[d].evaluate(e),x=a[d+1].evaluate(e);switch(this.operator){case"interpolate":return wi[this.type.kind](_,x,f);case"interpolate-hcl":return wi.color(_,x,f,"hcl");case"interpolate-lab":return wi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function fn(i,e,r,a){const o=a-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class Pa{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let a=null;const o=r.expectedType;o&&o.kind!=="value"&&(a=o);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,a,void 0,{typeAnnotation:"omit"});if(!_)return null;a=a||_.type,u.push(_)}if(!a)throw new Error("No output type");const d=o&&u.some(f=>Z(o,f.type));return new Pa(d?Ve:a,u)}evaluate(e){let r,a=null,o=0;for(const u of this.args)if(o++,a=u.evaluate(e),a&&a instanceof qt&&!a.available&&(r||(r=a.name),a=null,o===this.args.length&&(a=r)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ka{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;a.push([d,f])}const o=r.parse(e[e.length-1],e.length-1,r.expectedType,a);return o?new ka(a,o):null}outputDefined(){return this.result.outputDefined()}}class mn{constructor(e,r,a){this.type=e,this.index=r,this.input=a}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,ge),o=r.parse(e[2],2,O(r.expectedType||Ve));return a&&o?new mn(o.type.itemType,a,o):null}evaluate(e){const r=this.index.evaluate(e),a=this.input.evaluate(e);if(r<0)throw new bt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new bt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new bt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class gn{constructor(e,r){this.type=Fe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,Ve);return a&&o?j(a.type,[Fe,Ue,ge,dr,Ve])?new gn(a,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${N(a.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!W(r,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${N(gt(r))} instead.`);if(!W(a,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${N(gt(a))} instead.`);return a.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class za{constructor(e,r,a){this.type=ge,this.needle=e,this.haystack=r,this.fromIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,Ve);if(!a||!o)return null;if(!j(a.type,[Fe,Ue,ge,dr,Ve]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${N(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new za(a,o,u):null}return new za(a,o)}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!W(r,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${N(gt(r))} instead.`);if(!W(a,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${N(gt(a))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return a.indexOf(r,o)}return a.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class _n{constructor(e,r,a,o,u,d){this.inputType=e,this.type=r,this.input=a,this.cases=o,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let a,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},d=[];for(let x=2;x<e.length-1;x+=2){let b=e[x];const T=e[x+1];Array.isArray(b)||(b=[b]);const A=r.concat(x);if(b.length===0)return A.error("Expected at least one branch label.");for(const P of b){if(typeof P!="number"&&typeof P!="string")return A.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return A.error("Numeric branch labels must be integer values.");if(a){if(A.checkSubtype(a,gt(P)))return null}else a=gt(P);if(u[String(P)]!==void 0)return A.error("Branch labels must be unique.");u[String(P)]=d.length}const C=r.parse(T,x,o);if(!C)return null;o=o||C.type,d.push(C)}const f=r.parse(e[1],1,Ve);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,o);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new _n(a,o,f,u,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(gt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class yn{constructor(e,r,a){this.type=e,this.branches=r,this.otherwise=a}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const o=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,Fe);if(!f)return null;const _=r.parse(e[d+1],d+1,a);if(!_)return null;o.push([f,_]),a=a||_.type}const u=r.parse(e[e.length-1],e.length-1,a);if(!u)return null;if(!a)throw new Error("Can't infer output type");return new yn(a,o,u)}evaluate(e){for(const[r,a]of this.branches)if(r.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,a]of this.branches)e(r),e(a);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Da{constructor(e,r,a,o){this.type=e,this.input=r,this.beginIndex=a,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ve),o=r.parse(e[2],2,ge);if(!a||!o)return null;if(!j(a.type,[O(Ve),Ue,Ve]))return r.error(`Expected first argument to be of type array or string, but found ${N(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ge);return u?new Da(a.type,a,o,u):null}return new Da(a.type,a,o)}evaluate(e){const r=this.input.evaluate(e),a=this.beginIndex.evaluate(e);if(!W(r,["string","array"]))throw new bt(`Expected first argument to be of type array or string, but found ${N(gt(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(a,o)}return r.slice(a)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function bo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function wo(i,e,r,a){return a.compare(e,r)===0}function Ts(i,e,r){const a=i!=="=="&&i!=="!=";return class hu{constructor(u,d,f){this.type=Fe,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,Ve);if(!_)return null;if(!bo(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${N(_.type)}'.`);let x=d.parse(u[2],2,Ve);if(!x)return null;if(!bo(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${N(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${N(_.type)}' and '${N(x.type)}'.`);a&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Ri(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ri(_.type,[x])));let b=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,fr),!b)return null}return new hu(_,x,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(a&&this.hasUntypedArgument){const _=gt(d),x=gt(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new bt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const _=gt(d),x=gt(f);if(_.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Il=Ts("==",function(i,e,r){return e===r},wo),Al=Ts("!=",function(i,e,r){return e!==r},function(i,e,r,a){return!wo(0,e,r,a)}),Ml=Ts("<",function(i,e,r){return e<r},function(i,e,r,a){return a.compare(e,r)<0}),El=Ts(">",function(i,e,r){return e>r},function(i,e,r,a){return a.compare(e,r)>0}),Cl=Ts("<=",function(i,e,r){return e<=r},function(i,e,r,a){return a.compare(e,r)<=0}),Pl=Ts(">=",function(i,e,r){return e>=r},function(i,e,r,a){return a.compare(e,r)>=0});class xn{constructor(e,r,a,o,u){this.type=Ue,this.number=e,this.locale=r,this.currency=a,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const a=r.parse(e[1],1,ge);if(!a)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,Ue),!u))return null;let d=null;if(o.currency&&(d=r.parse(o.currency,1,Ue),!d))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,ge),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=r.parse(o["max-fraction-digits"],1,ge),!_)?null:new xn(a,u,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class La{constructor(e){this.type=R,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,ge),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,O(Ue)),!x))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,ii),!b))return null;const T=o[o.length-1];T.scale=_,T.font=x,T.textColor=b}else{const _=r.parse(e[d],1,Ve);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:_,scale:null,font:null,textColor:null})}}return new La(o)}evaluate(e){return new Ht(this.sections.map(r=>{const a=r.content.evaluate(e);return gt(a)===M?new xa("",a,null,null,null):new xa(Je(a),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class vn{constructor(e){this.type=M,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const a=r.parse(e[1],1,Ue);return a?new vn(a):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),a=qt.fromString(r);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(r)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class bn{constructor(e){this.type=ge,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=r.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${N(a.type)} instead.`):new bn(a):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new bt(`Expected value to be of type string or array, but found ${N(gt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Is={"==":Il,"!=":Al,">":El,"<":Ml,">=":Pl,"<=":Cl,array:Ri,at:mn,boolean:Ri,case:yn,coalesce:Pa,collator:Sa,format:La,image:vn,in:gn,"index-of":za,interpolate:Si,"interpolate-hcl":Si,"interpolate-lab":Si,length:bn,let:ka,literal:Hr,match:_n,number:Ri,"number-format":xn,object:Ri,slice:Da,step:Lr,string:Ri,"to-boolean":zr,"to-color":zr,"to-number":zr,"to-string":zr,var:Ia,within:Kr};function So(i,[e,r,a,o]){e=e.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);const u=o?o.evaluate(i):1,d=va(e,r,a,u);if(d)throw new bt(d);return new it(e/255,r/255,a/255,u,!1)}function To(i,e){return i in e}function wn(i,e){const r=e[i];return r===void 0?null:r}function Yr(i){return{type:i}}function Io(i){return{result:"success",value:i}}function Br(i){return{result:"error",value:i}}function As(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ao(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Sn(i){return!!i.expression&&i.expression.interpolated}function Qe(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function _t(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function kl(i){return i}function We(i,e){const r=e.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",o=a||!(a||i.property!==void 0),u=i.type||(Sn(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?it.parse:bi.parse;(i=Qi({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],b(T[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=Ks;else if(u==="interval")f=dt;else if(u==="categorical"){f=yt,_=Object.create(null);for(const b of i.stops)_[b[0]]=b[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Mo}if(a){const b={},T=[];for(let P=0;P<i.stops.length;P++){const D=i.stops[P],V=D[0].zoom;b[V]===void 0&&(b[V]={zoom:V,type:i.type,property:i.property,default:i.default,stops:[]},T.push(V)),b[V].stops.push([D[0].value,D[1]])}const A=[];for(const P of T)A.push([b[P].zoom,We(b[P],e)]);const C={name:"linear"};return{kind:"composite",interpolationType:C,interpolationFactor:Si.interpolationFactor.bind(void 0,C),zoomStops:A.map(P=>P[0]),evaluate:({zoom:P},D)=>Ks({stops:A,base:i.base},e,P).evaluate(P,D)}}if(o){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Si.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>f(i,e,T,_,x)}}return{kind:"source",evaluate(b,T){const A=T&&T.properties?T.properties[i.property]:void 0;return A===void 0?Jr(i.default,e.default):f(i,e,A,_,x)}}}function Jr(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function yt(i,e,r,a,o){return Jr(typeof r===o?a[r]:void 0,i.default,e.default)}function dt(i,e,r){if(Qe(r)!=="number")return Jr(i.default,e.default);const a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];const o=Ss(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Ks(i,e,r){const a=i.base!==void 0?i.base:1;if(Qe(r)!=="number")return Jr(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=Ss(i.stops.map(b=>b[0]),r),d=function(b,T,A,C){const P=C-A,D=b-A;return P===0?0:T===1?D/P:(Math.pow(T,D)-1)/(Math.pow(T,P)-1)}(r,a,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=wi[e.type]||kl;return typeof f.evaluate=="function"?{evaluate(...b){const T=f.evaluate.apply(void 0,b),A=_.evaluate.apply(void 0,b);if(T!==void 0&&A!==void 0)return x(T,A,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function Mo(i,e,r){switch(e.type){case"color":r=it.parse(r);break;case"formatted":r=Ht.fromString(r.toString());break;case"resolvedImage":r=qt.fromString(r.toString());break;case"padding":r=bi.parse(r);break;default:Qe(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Jr(r,i.default,e.default)}Fi.register(Is,{error:[{kind:"error"},[Ue],(i,[e])=>{throw new bt(e.evaluate(i))}],typeof:[Ue,[Ve],(i,[e])=>N(gt(e.evaluate(i)))],"to-rgba":[O(ge,4),[ii],(i,[e])=>{const[r,a,o,u]=e.evaluate(i).rgb;return[255*r,255*a,255*o,u]}],rgb:[ii,[ge,ge,ge],So],rgba:[ii,[ge,ge,ge,ge],So],has:{type:Fe,overloads:[[[Ue],(i,[e])=>To(e.evaluate(i),i.properties())],[[Ue,er],(i,[e,r])=>To(e.evaluate(i),r.evaluate(i))]]},get:{type:Ve,overloads:[[[Ue],(i,[e])=>wn(e.evaluate(i),i.properties())],[[Ue,er],(i,[e,r])=>wn(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ve,[Ue],(i,[e])=>wn(e.evaluate(i),i.featureState||{})],properties:[er,[],i=>i.properties()],"geometry-type":[Ue,[],i=>i.geometryType()],id:[Ve,[],i=>i.id()],zoom:[ge,[],i=>i.globals.zoom],"heatmap-density":[ge,[],i=>i.globals.heatmapDensity||0],"line-progress":[ge,[],i=>i.globals.lineProgress||0],accumulated:[Ve,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ge,Yr(ge),(i,e)=>{let r=0;for(const a of e)r+=a.evaluate(i);return r}],"*":[ge,Yr(ge),(i,e)=>{let r=1;for(const a of e)r*=a.evaluate(i);return r}],"-":{type:ge,overloads:[[[ge,ge],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ge],(i,[e])=>-e.evaluate(i)]]},"/":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ge,[ge,ge],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ge,[ge],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))],log2:[ge,[ge],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ge,[ge],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ge,[ge],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ge,[ge],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ge,[ge],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ge,[ge],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ge,[ge],(i,[e])=>Math.atan(e.evaluate(i))],min:[ge,Yr(ge),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ge,Yr(ge),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ge,[ge],(i,[e])=>Math.abs(e.evaluate(i))],round:[ge,[ge],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ge,[ge],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Fe,[Ue,Ve],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Fe,[Ve],(i,[e])=>i.id()===e.value],"filter-type-==":[Fe,[Ue],(i,[e])=>i.geometryType()===e.value],"filter-<":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<o}],"filter-id-<":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<a}],"filter->":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>o}],"filter-id->":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>a}],"filter-<=":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<=a}],"filter->=":[Fe,[Ue,Ve],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[Fe,[Ve],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>=a}],"filter-has":[Fe,[Ve],(i,[e])=>e.value in i.properties()],"filter-has-id":[Fe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Fe,[O(Ue)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Fe,[O(Ve)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Fe,[Ue,O(Ve)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Fe,[Ue,O(Ve)],(i,[e,r])=>function(a,o,u,d){for(;u<=d;){const f=u+d>>1;if(o[f]===a)return!0;o[f]>a?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Yr(Fe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Yr(Fe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Fe,[Fe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Fe,[Ue],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ue,[Ue],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ue,[Ue],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ue,Yr(Ve),(i,e)=>e.map(r=>Je(r.evaluate(i))).join("")],"resolved-locale":[Ue,[fr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Tn{constructor(e,r){var a;this.expression=e,this._warningHistory={},this._evaluator=new ln,this._defaultValue=r?(a=r).type==="color"&&_t(a.default)?new it(0,0,0,0):a.type==="color"?it.parse(a.default)||null:a.type==="padding"?bi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Bi.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,a,o,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new bt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ba(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Is}function Ra(i,e){const r=new wa(Is,Aa,[],e?function(o){const u={color:ii,string:Ue,number:ge,enum:Ue,boolean:Fe,formatted:R,padding:I,resolvedImage:M,variableAnchorOffsetCollection:k};return o.type==="array"?O(u[o.value]||Ve,o.length):u[o.type]}(e):void 0),a=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Io(new Tn(a,e)):Br(r.errors)}class In{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Hs(r.expression)}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}}class Fa{constructor(e,r,a,o){this.kind=e,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Hs(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}interpolationFactor(e,r,a){return this.interpolationType?Si.interpolationFactor(this.interpolationType,e,r,a):0}}function An(i,e){const r=Ra(i,e);if(r.result==="error")return r;const a=r.value.expression,o=Ma(a);if(!o&&!As(e))return Br([new vt("","data expressions not supported")]);const u=Ea(a,["zoom"]);if(!u&&!Ao(e))return Br([new vt("","zoom expressions not supported")]);const d=Js(a);return d||u?d instanceof vt?Br([d]):d instanceof Si&&!Sn(e)?Br([new vt("",'"interpolate" expressions cannot be used with this property')]):Io(d?new Fa(o?"camera":"composite",r.value,d.labels,d instanceof Si?d.interpolation:void 0):new In(o?"constant":"source",r.value)):Br([new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ys{constructor(e,r){this._parameters=e,this._specification=r,Qi(this,We(this._parameters,this._specification))}static deserialize(e){return new Ys(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Js(i){let e=null;if(i instanceof ka)e=Js(i.result);else if(i instanceof Pa){for(const r of i.args)if(e=Js(r),e)break}else(i instanceof Lr||i instanceof Si)&&i.input instanceof Fi&&i.input.name==="zoom"&&(e=i);return e instanceof vt||i.eachChild(r=>{const a=Js(r);a instanceof vt?e=a:!e&&a?e=new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new vt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Qs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Qs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const zl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Mn(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Qs(i)||(i=Oa(i));const e=Ra(i,zl);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,o)=>e.value.evaluate(r,a,{},o),needGeometry:Eo(i)}}function Dl(i,e){return i<e?-1:i>e?1:0}function Eo(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Eo(i[e]))return!0;return!1}function Oa(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?En(i[1],i[2],"=="):e==="!="?ea(En(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?En(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Oa))):e==="all"?["all"].concat(i.slice(1).map(Oa)):e==="none"?["all"].concat(i.slice(1).map(Oa).map(ea)):e==="in"?Co(i[1],i.slice(2)):e==="!in"?ea(Co(i[1],i.slice(2))):e==="has"?Po(i[1]):e==="!has"?ea(Po(i[1])):e!=="within"||i;var r}function En(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Co(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Dl)]]:["filter-in-small",i,["literal",e]]}}function Po(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function ea(i){return["!",i]}function Va(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${Va(u)},`;return`${o}]`}const r=Object.keys(i).sort();let a="{";for(let o=0;o<r.length;o++)a+=`${JSON.stringify(r[o])}:${Va(i[r[o]])},`;return`${a}}`}function Na(i){let e="";for(const r of ui)e+=`/${Va(i[r])}`;return e}function ko(i){const e=i.value;return e?[new fe(i.key,e,"constants have been deprecated as of v8")]:[]}function wt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Qr(i){if(Array.isArray(i))return i.map(Qr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Qr(i[r]);return e}return wt(i)}function pi(i){const e=i.key,r=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let _=[];const x=Qe(r);if(x!=="object")return[new fe(e,r,`object expected, ${x} found`)];for(const b in r){const T=b.split(".")[0],A=a[T]||a["*"];let C;if(o[T])C=o[T];else if(a[T])C=f;else if(o["*"])C=o["*"];else{if(!a["*"]){_.push(new fe(e,r[b],`unknown property "${b}"`));continue}C=f}_=_.concat(C({key:(e&&`${e}.`)+b,value:r[b],valueSpec:A,style:u,styleSpec:d,object:r,objectKey:b,validateSpec:f},r))}for(const b in a)o[b]||a[b].required&&a[b].default===void 0&&r[b]===void 0&&_.push(new fe(e,r,`missing required property "${b}"`));return _}function Ms(i){const e=i.value,r=i.valueSpec,a=i.style,o=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(Qe(e)!=="array")return[new fe(u,e,`array expected, ${Qe(e)} found`)];if(r.length&&e.length!==r.length)return[new fe(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new fe(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};o.$version<7&&(f.function=r.function),Qe(r.value)==="object"&&(f=r.value);let _=[];for(let x=0;x<e.length;x++)_=_.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:a,styleSpec:o,key:`${u}[${x}]`}));return _}function ta(i){const e=i.key,r=i.value,a=i.valueSpec;let o=Qe(r);return o==="number"&&r!=r&&(o="NaN"),o!=="number"?[new fe(e,r,`number expected, ${o} found`)]:"minimum"in a&&r<a.minimum?[new fe(e,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new fe(e,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function Ua(i){const e=i.valueSpec,r=wt(i.value.type);let a,o,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=Qe(i.value.stops)==="array"&&Qe(i.value.stops[0])==="array"&&Qe(i.value.stops[0][0])==="object",b=pi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(C){if(r==="identity")return[new fe(C.key,C.value,'identity function may not have a "stops" property')];let P=[];const D=C.value;return P=P.concat(Ms({key:C.key,value:D,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:T})),Qe(D)==="array"&&D.length===0&&P.push(new fe(C.key,D,"array must have at least one stop")),P},default:function(C){return C.validateSpec({key:C.key,value:C.value,valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec})}}});return r==="identity"&&f&&b.push(new fe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new fe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Sn(i.valueSpec)&&b.push(new fe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!As(i.valueSpec)?b.push(new fe(i.key,i.value,"property functions not supported")):f&&!Ao(i.valueSpec)&&b.push(new fe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||b.push(new fe(i.key,i.value,'"property" property is required')),b;function T(C){let P=[];const D=C.value,V=C.key;if(Qe(D)!=="array")return[new fe(V,D,`array expected, ${Qe(D)} found`)];if(D.length!==2)return[new fe(V,D,`array length 2 expected, length ${D.length} found`)];if(x){if(Qe(D[0])!=="object")return[new fe(V,D,`object expected, ${Qe(D[0])} found`)];if(D[0].zoom===void 0)return[new fe(V,D,"object stop key must have zoom")];if(D[0].value===void 0)return[new fe(V,D,"object stop key must have value")];if(u&&u>wt(D[0].zoom))return[new fe(V,D[0].zoom,"stop zoom values must appear in ascending order")];wt(D[0].zoom)!==u&&(u=wt(D[0].zoom),o=void 0,d={}),P=P.concat(pi({key:`${V}[0]`,value:D[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:ta,value:A}}))}else P=P.concat(A({key:`${V}[0]`,value:D[0],valueSpec:{},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},D));return Ba(Qr(D[1]))?P.concat([new fe(`${V}[1]`,D[1],"expressions are not allowed in function stops.")]):P.concat(C.validateSpec({key:`${V}[1]`,value:D[1],valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec}))}function A(C,P){const D=Qe(C.value),V=wt(C.value),$=C.value!==null?C.value:P;if(a){if(D!==a)return[new fe(C.key,$,`${D} stop domain type must match previous stop domain type ${a}`)]}else a=D;if(D!=="number"&&D!=="string"&&D!=="boolean")return[new fe(C.key,$,"stop domain value must be a number, string, or boolean")];if(D!=="number"&&r!=="categorical"){let H=`number expected, ${D} found`;return As(e)&&r===void 0&&(H+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new fe(C.key,$,H)]}return r!=="categorical"||D!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&D==="number"&&o!==void 0&&V<o?[new fe(C.key,$,"stop domain values must appear in ascending order")]:(o=V,r==="categorical"&&V in d?[new fe(C.key,$,"stop domain values must be unique")]:(d[V]=!0,[])):[new fe(C.key,$,`integer expected, found ${V}`)]}}function es(i){const e=(i.expressionContext==="property"?An:Ra)(Qr(i.value),i.valueSpec);if(e.result==="error")return e.value.map(a=>new fe(`${i.key}${a.key}`,i.value,a.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new fe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Hs(r))return[new fe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Hs(r))return[new fe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ea(r,["zoom","feature-state"]))return[new fe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ma(r))return[new fe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ia(i){const e=i.key,r=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?a.values.indexOf(wt(r))===-1&&o.push(new fe(e,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(wt(r))===-1&&o.push(new fe(e,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function Es(i){return Qs(Qr(i.value))?es(Qi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zo(i)}function zo(i){const e=i.value,r=i.key;if(Qe(e)!=="array")return[new fe(r,e,`array expected, ${Qe(e)} found`)];const a=i.styleSpec;let o,u=[];if(e.length<1)return[new fe(r,e,"filter array must have at least 1 element")];switch(u=u.concat(ia({key:`${r}[0]`,value:e[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),wt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&wt(e[1])==="$type"&&u.push(new fe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new fe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Qe(e[1]),o!=="string"&&u.push(new fe(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let d=2;d<e.length;d++)o=Qe(e[d]),wt(e[1])==="$type"?u=u.concat(ia({key:`${r}[${d}]`,value:e[d],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new fe(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat(zo({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":o=Qe(e[1]),e.length!==2?u.push(new fe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new fe(`${r}[1]`,e[1],`string expected, ${o} found`));break;case"within":o=Qe(e[1]),e.length!==2?u.push(new fe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="object"&&u.push(new fe(`${r}[1]`,e[1],`object expected, ${o} found`))}return u}function Do(i,e){const r=i.key,a=i.validateSpec,o=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,_=u[`${e}_${i.layerType}`];if(!_)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return a({key:r,value:d,valueSpec:u.transition,style:o,styleSpec:u});const b=i.valueSpec||_[f];if(!b)return[new fe(r,d,`unknown property "${f}"`)];let T;if(Qe(d)==="string"&&As(b)&&!b.tokens&&(T=/^{([^}]+)}$/.exec(d)))return[new fe(r,d,`"${f}" does not support interpolation syntax
|
|
2
2
|
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const A=[];return i.layerType==="symbol"&&(f==="text-field"&&o&&!o.glyphs&&A.push(new fe(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&_t(Qr(d))&&wt(d.type)==="identity"&&A.push(new fe(r,d,'"text-font" does not support identity functions'))),A.concat(a({key:i.key,value:d,valueSpec:b,style:o,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Lo(i){return Do(i,"paint")}function Bo(i){return Do(i,"layout")}function Ro(i){let e=[];const r=i.value,a=i.key,o=i.style,u=i.styleSpec;r.type||r.ref||e.push(new fe(a,r,'either "type" or "ref" is required'));let d=wt(r.type);const f=wt(r.ref);if(r.id){const _=wt(r.id);for(let x=0;x<i.arrayIndex;x++){const b=o.layers[x];wt(b.id)===_&&e.push(new fe(a,r.id,`duplicate layer id "${r.id}", previously used at line ${b.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new fe(a,r[x],`"${x}" is prohibited for ref layers`))}),o.layers.forEach(x=>{wt(x.id)===f&&(_=x)}),_?_.ref?e.push(new fe(a,r.ref,"ref cannot reference another ref layer")):d=wt(_.type):e.push(new fe(a,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const _=o.sources&&o.sources[r.source],x=_&&wt(_.type);_?x==="vector"&&d==="raster"?e.push(new fe(a,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?e.push(new fe(a,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?e.push(new fe(a,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new fe(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new fe(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new fe(a,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new fe(a,r.source,`source "${r.source}" not found`))}else e.push(new fe(a,r,'missing required property "source"'));return e=e.concat(pi({key:a,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Es,layout:_=>pi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Bo(Qi({layerType:d},x))}}),paint:_=>pi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Lo(Qi({layerType:d},x))}})}})),e}function tr(i){const e=i.value,r=i.key,a=Qe(e);return a!=="string"?[new fe(r,e,`string expected, ${a} found`)]:[]}const ra={promoteId:function({key:i,value:e}){if(Qe(e)==="string")return tr({key:i,value:e});{const r=[];for(const a in e)r.push(...tr({key:`${i}.${a}`,value:e[a]}));return r}}};function Ti(i){const e=i.value,r=i.key,a=i.styleSpec,o=i.style,u=i.validateSpec;if(!e.type)return[new fe(r,e,'"type" is required')];const d=wt(e.type);let f;switch(d){case"vector":case"raster":return f=pi({key:r,value:e,valueSpec:a[`source_${d.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:ra,validateSpec:u}),f;case"raster-dem":return f=function(_){var x;const b=(x=_.sourceName)!==null&&x!==void 0?x:"",T=_.value,A=_.styleSpec,C=A.source_raster_dem,P=_.style;let D=[];const V=Qe(T);if(T===void 0)return D;if(V!=="object")return D.push(new fe("source_raster_dem",T,`object expected, ${V} found`)),D;const $=wt(T.encoding)==="custom",H=["redFactor","greenFactor","blueFactor","baseShift"],q=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const Y in T)!$&&H.includes(Y)?D.push(new fe(Y,T[Y],`In "${b}": "${Y}" is only valid when "encoding" is set to "custom". ${q} encoding found`)):C[Y]?D=D.concat(_.validateSpec({key:Y,value:T[Y],valueSpec:C[Y],validateSpec:_.validateSpec,style:P,styleSpec:A})):D.push(new fe(Y,T[Y],`unknown property "${Y}"`));return D}({sourceName:r,value:e,style:i.style,styleSpec:a,validateSpec:u}),f;case"geojson":if(f=pi({key:r,value:e,valueSpec:a.source_geojson,style:o,styleSpec:a,validateSpec:u,objectElementValidators:ra}),e.cluster)for(const _ in e.clusterProperties){const[x,b]=e.clusterProperties[_],T=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...es({key:`${r}.${_}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...es({key:`${r}.${_}.reduce`,value:T,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return pi({key:r,value:e,valueSpec:a.source_video,style:o,validateSpec:u,styleSpec:a});case"image":return pi({key:r,value:e,valueSpec:a.source_image,style:o,validateSpec:u,styleSpec:a});case"canvas":return[new fe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ia({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:u,styleSpec:a})}}function sa(i){const e=i.value,r=i.styleSpec,a=r.light,o=i.style;let u=[];const d=Qe(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new fe("light",e,`object expected, ${d} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&a[_[1]]&&a[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:o,styleSpec:r}):a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new fe(f,e[f],`unknown property "${f}"`)])}return u}function Fo(i){const e=i.value,r=i.styleSpec,a=r.terrain,o=i.style;let u=[];const d=Qe(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new fe("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new fe(f,e[f],`unknown property "${f}"`)]);return u}function Oo(i){let e=[];const r=i.value,a=i.key;if(Array.isArray(r)){const o=[],u=[];for(const d in r)r[d].id&&o.includes(r[d].id)&&e.push(new fe(a,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),o.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new fe(a,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(pi({key:`${a}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return tr({key:a,value:r})}const Vo={"*":()=>[],array:Ms,boolean:function(i){const e=i.value,r=i.key,a=Qe(e);return a!=="boolean"?[new fe(r,e,`boolean expected, ${a} found`)]:[]},number:ta,color:function(i){const e=i.key,r=i.value,a=Qe(r);return a!=="string"?[new fe(e,r,`color expected, ${a} found`)]:it.parse(String(r))?[]:[new fe(e,r,`color expected, "${r}" found`)]},constants:ko,enum:ia,filter:Es,function:Ua,layer:Ro,object:pi,source:Ti,light:sa,terrain:Fo,string:tr,formatted:function(i){return tr(i).length===0?[]:es(i)},resolvedImage:function(i){return tr(i).length===0?[]:es(i)},padding:function(i){const e=i.key,r=i.value;if(Qe(r)==="array"){if(r.length<1||r.length>4)return[new fe(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let o=[];for(let u=0;u<r.length;u++)o=o.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:a}));return o}return ta({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,a=Qe(r),o=i.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new fe(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let d=0;d<r.length;d+=2)u=u.concat(ia({key:`${e}[${d}]`,value:r[d],valueSpec:o.layout_symbol["text-anchor"]})),u=u.concat(Ms({key:`${e}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:o}));return u},sprite:Oo};function mr(i){const e=i.value,r=i.valueSpec,a=i.styleSpec;return i.validateSpec=mr,r.expression&&_t(wt(e))?Ua(i):r.expression&&Ba(Qr(e))?es(i):r.type&&Vo[r.type]?Vo[r.type](i):pi(Qi({},i,{valueSpec:r.type?a[r.type]:r}))}function No(i){const e=i.value,r=i.key,a=tr(i);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new fe(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new fe(r,e,'"glyphs" url must include a "{range}" token'))),a}function Oi(i,e=re){let r=[];return r=r.concat(mr({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:mr,objectElementValidators:{glyphs:No,"*":()=>[]}})),i.constants&&(r=r.concat(ko({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:mr}))),$a(r)}function gr(i){return function(e){return i({...e,validateSpec:mr})}}function $a(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function _r(i){return function(...e){return $a(i.apply(this,e))}}Oi.source=_r(gr(Ti)),Oi.sprite=_r(gr(Oo)),Oi.glyphs=_r(gr(No)),Oi.light=_r(gr(sa)),Oi.terrain=_r(gr(Fo)),Oi.layer=_r(gr(Ro)),Oi.filter=_r(gr(Es)),Oi.paintProperty=_r(gr(Lo)),Oi.layoutProperty=_r(gr(Bo));const yr=Oi,Ll=yr.light,Cn=yr.paintProperty,Uo=yr.layoutProperty;function ja(i,e){let r=!1;if(e&&e.length)for(const a of e)i.fire(new Pr(new Error(a.message))),r=!0;return r}class Cs{constructor(e,r,a){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(a=d[2]);for(let _=0;_<this.d*this.d;_++){const x=d[3+_],b=d[3+_+1];o.push(x===b?null:d.subarray(x,b))}const f=d[3+o.length+1];this.keys=d.subarray(d[3+o.length],f),this.bboxes=d.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let d=0;d<this.d*this.d;d++)o.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=a,this.scale=r/e,this.uid=0;const u=a/r*e;this.min=-u,this.max=e+u}insert(e,r,a,o,u){this._forEachCell(r,a,o,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,a,o,u,d){this.cells[u].push(d)}query(e,r,a,o,u){const d=this.min,f=this.max;if(e<=d&&r<=d&&f<=a&&f<=o&&!u)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,a,o,this._queryCell,_,{},u),_}}_queryCell(e,r,a,o,u,d,f,_){const x=this.cells[u];if(x!==null){const b=this.keys,T=this.bboxes;for(let A=0;A<x.length;A++){const C=x[A];if(f[C]===void 0){const P=4*C;(_?_(T[P+0],T[P+1],T[P+2],T[P+3]):e<=T[P+2]&&r<=T[P+3]&&a>=T[P+0]&&o>=T[P+1])?(f[C]=!0,d.push(b[C])):f[C]=!1}}}}_forEachCell(e,r,a,o,u,d,f,_){const x=this._convertToCellCoord(e),b=this._convertToCellCoord(r),T=this._convertToCellCoord(a),A=this._convertToCellCoord(o);for(let C=x;C<=T;C++)for(let P=b;P<=A;P++){const D=this.d*P+C;if((!_||_(this._convertFromCellCoord(C),this._convertFromCellCoord(P),this._convertFromCellCoord(C+1),this._convertFromCellCoord(P+1)))&&u.call(this,e,r,a,o,D,d,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let a=0;for(let d=0;d<this.cells.length;d++)a+=this.cells[d].length;const o=new Int32Array(r+a+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let u=r;for(let d=0;d<e.length;d++){const f=e[d];o[3+d]=u,o.set(f,u),u+=f.length}return o[3+e.length]=u,o.set(this.keys,u),u+=this.keys.length,o[3+e.length+1]=u,o.set(this.bboxes,u),u+=this.bboxes.length,o.buffer}static serialize(e,r){const a=e.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(e){return new Cs(e.buffer)}}const xr={};function we(i,e,r={}){if(xr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),xr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}we("Object",Object),we("TransferableGridIndex",Cs),we("Color",it),we("Error",Error),we("AJAXError",Mr),we("ResolvedImage",qt),we("StylePropertyFunction",Ys),we("StyleExpression",Tn,{omit:["_evaluator"]}),we("ZoomDependentExpression",Fa),we("ZoomConstantExpression",In),we("CompoundExpression",Fi,{omit:["_evaluate"]});for(const i in Is)Is[i]._classRegistryKey||we(`Expression_${i}`,Is[i]);function qa(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Rr(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(qa(i)||qs(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const a of i)r.push(Rr(a,e));return r}if(typeof i=="object"){const r=i.constructor,a=r._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");if(!xr[a])throw new Error(`${a} is not registered.`);const o=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||xr[a].omit.indexOf(u)>=0)continue;const d=i[u];o[u]=xr[a].shallow.indexOf(u)>=0?d:Rr(d,e)}i instanceof Error&&(o.message=i.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(o.$name=a),o}throw new Error("can't serialize object of type "+typeof i)}function Ps(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||qa(i)||qs(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ps);if(typeof i=="object"){const e=i.$name||"Object";if(!xr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=xr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const a=Object.create(r.prototype);for(const o of Object.keys(i)){if(o==="$name")continue;const u=i[o];a[o]=xr[e].shallow.indexOf(o)>=0?u:Ps(u)}return a}throw new Error("can't deserialize object of type "+typeof i)}class $o{constructor(){this.first=!0}update(e,r){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}const ve={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Pn(i){for(const e of i)if(zn(e.charCodeAt(0)))return!0;return!1}function kn(i){for(const e of i)if(!Bl(e.charCodeAt(0)))return!1;return!0}function Bl(i){return!(ve.Arabic(i)||ve["Arabic Supplement"](i)||ve["Arabic Extended-A"](i)||ve["Arabic Presentation Forms-A"](i)||ve["Arabic Presentation Forms-B"](i))}function zn(i){return!(i!==746&&i!==747&&(i<4352||!(ve["Bopomofo Extended"](i)||ve.Bopomofo(i)||ve["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ve["CJK Compatibility Ideographs"](i)||ve["CJK Compatibility"](i)||ve["CJK Radicals Supplement"](i)||ve["CJK Strokes"](i)||!(!ve["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ve["CJK Unified Ideographs Extension A"](i)||ve["CJK Unified Ideographs"](i)||ve["Enclosed CJK Letters and Months"](i)||ve["Hangul Compatibility Jamo"](i)||ve["Hangul Jamo Extended-A"](i)||ve["Hangul Jamo Extended-B"](i)||ve["Hangul Jamo"](i)||ve["Hangul Syllables"](i)||ve.Hiragana(i)||ve["Ideographic Description Characters"](i)||ve.Kanbun(i)||ve["Kangxi Radicals"](i)||ve["Katakana Phonetic Extensions"](i)||ve.Katakana(i)&&i!==12540||!(!ve["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ve["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ve["Unified Canadian Aboriginal Syllabics"](i)||ve["Unified Canadian Aboriginal Syllabics Extended"](i)||ve["Vertical Forms"](i)||ve["Yijing Hexagram Symbols"](i)||ve["Yi Syllables"](i)||ve["Yi Radicals"](i))))}function jo(i){return!(zn(i)||function(e){return!!(ve["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ve["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ve["Letterlike Symbols"](e)||ve["Number Forms"](e)||ve["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ve["Control Pictures"](e)&&e!==9251||ve["Optical Character Recognition"](e)||ve["Enclosed Alphanumerics"](e)||ve["Geometric Shapes"](e)||ve["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ve["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ve["CJK Symbols and Punctuation"](e)||ve.Katakana(e)||ve["Private Use Area"](e)||ve["CJK Compatibility Forms"](e)||ve["Small Form Variants"](e)||ve["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function qo(i){return i>=1424&&i<=2303||ve["Arabic Presentation Forms-A"](i)||ve["Arabic Presentation Forms-B"](i)}function Zo(i,e){return!(!e&&qo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ve.Khmer(i))}function Rl(i){for(const e of i)if(qo(e.charCodeAt(0)))return!0;return!1}const Dn="deferred",Ln="loading",Bn="loaded";let Rn=null,di="unavailable",Fr=null;const aa=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(di="error"),Rn&&Rn(i)};function Fn(){na.fire(new Cr("pluginStateChange",{pluginStatus:di,pluginURL:Fr}))}const na=new Gr,On=function(){return di},Go=function(){if(di!==Dn||!Fr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");di=Ln,Fn(),Fr&&Xs({url:Fr},i=>{i?aa(i):(di=Bn,Fn())})},Ii={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>di===Bn||Ii.applyArabicShaping!=null,isLoading:()=>di===Ln,setState(i){if(!ki())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");di=i.pluginStatus,Fr=i.pluginURL},isParsed(){if(!ki())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ii.applyArabicShaping!=null&&Ii.processBidirectionalText!=null&&Ii.processStyledBidirectionalText!=null},getPluginURL(){if(!ki())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Fr}};class ht{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $o,this.transition={})}isSupportedScript(e){return function(r,a){for(const o of r)if(!Zo(o.charCodeAt(0),a))return!1;return!0}(e,Ii.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Za{constructor(e,r){this.property=e,this.value=r,this.expression=function(a,o){if(_t(a))return new Ys(a,o);if(Ba(a)){const u=An(a,o);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=a;return o.type==="color"&&typeof a=="string"?u=it.parse(a):o.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?o.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(u=Bi.parse(a)):u=bi.parse(a),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,a){return this.property.possiblyEvaluate(this,e,r,a)}}class Vn{constructor(e){this.property=e,this.value=new Za(e,void 0)}transitioned(e,r){return new Wo(this.property,this.value,r,$t({},e.transition,this.transition),e.now)}untransitioned(){return new Wo(this.property,this.value,null,{},0)}}class Xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return $i(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vn(this._values[e].property)),this._values[e].value=new Za(this._values[e].property,r===null?void 0:$i(r))}getTransition(e){return $i(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vn(this._values[e].property)),this._values[e].transition=$i(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a);const o=this.getTransition(r);o!==void 0&&(e[`${r}-transition`]=o)}return e}transitioned(e,r){const a=new Ho(this._properties);for(const o of Object.keys(this._values))a._values[o]=this._values[o].transitioned(e,r._values[o]);return a}untransitioned(){const e=new Ho(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Wo{constructor(e,r,a,o,u){this.property=e,this.value=r,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=a)}possiblyEvaluate(e,r,a){const o=e.now||0,u=this.value.possiblyEvaluate(e,r,a),d=this.prior;if(d){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o<this.begin)return d.possiblyEvaluate(e,r,a);{const f=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,a),u,function(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,b=x*_;return 4*(_<.5?b:3*(_-x)+b-.75)}(f))}}return u}}class Ho{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,a){const o=new Ga(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Fl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return $i(this._values[e].value)}setValue(e,r){this._values[e]=new Za(this._values[e].property,r===null?void 0:$i(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a)}return e}possiblyEvaluate(e,r,a){const o=new Ga(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}}class ri{constructor(e,r,a){this.property=e,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,a,o){return this.property.evaluate(this.value,this.parameters,e,r,a,o)}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ce{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,a){const o=wi[this.specification.type];return o?o(e,r,a):e}}class De{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,a,o){return new ri(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},a,o)}:e.expression,r)}interpolate(e,r,a){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ri(this,{kind:"constant",value:void 0},e.parameters);const o=wi[this.specification.type];if(o){const u=o(e.value.value,r.value.value,a);return new ri(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,a,o,u,d){return e.kind==="constant"?e.value:e.evaluate(r,a,o,u,d)}}class oa extends De{possiblyEvaluate(e,r,a,o){if(e.value===void 0)return new ri(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new ri(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ri(this,{kind:"constant",value:u},r)}return new ri(this,e.expression,r)}evaluate(e,r,a,o,u,d){if(e.kind==="source"){const f=e.evaluate(r,a,o,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},a,o),e.evaluate({zoom:Math.floor(r.zoom)},a,o),e.evaluate({zoom:Math.floor(r.zoom)+1},a,o),r):e.value}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class Nn{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new ht(Math.floor(r.zoom-1),r)),e.expression.evaluate(new ht(Math.floor(r.zoom),r)),e.expression.evaluate(new ht(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class Un{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){return!!e.expression.evaluate(r,null,{},a,o)}interpolate(){return!1}}class Mt{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const a=e[r];a.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new Za(a,void 0),u=this.defaultTransitionablePropertyValues[r]=new Vn(a);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}we("DataDrivenProperty",De),we("DataConstantProperty",Ce),we("CrossFadedDataDrivenProperty",oa),we("CrossFadedProperty",Nn),we("ColorRampProperty",Un);const $n="-transition";class Vi extends Gr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Fl(r.layout)),r.paint)){this._transitionablePaint=new Xo(r.paint);for(const a in e.paint)this.setPaintProperty(a,e.paint[a],{validate:!1});for(const a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ga(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,a={}){r!=null&&this._validate(Uo,`layers.${this.id}.layout.${e}`,e,r,a)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith($n)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,a={}){if(r!=null&&this._validate(Cn,`layers.${this.id}.paint.${e}`,e,r,a))return!1;if(e.endsWith($n))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",d=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,a){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),fs(e,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(e,r,a,o,u={}){return(!u||u.validate!==!1)&&ja(this,e.call(yr,{key:r,layerType:this.type,objectKey:a,value:o,styleSpec:re,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ri&&As(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ko={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ts{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class St{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,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 xt(i,e=1){let r=0,a=0;return{members:i.map(o=>{const u=Ko[o.type].BYTES_PER_ELEMENT,d=r=ks(r,Math.max(e,u)),f=o.components||1;return a=Math.max(a,u),r+=u*f,{name:o.name,type:o.type,components:f,offset:d}}),size:ks(r,Math.max(a,e)),alignment:e}}function ks(i,e){return Math.ceil(i/e)*e}class la extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.int16[o+0]=r,this.int16[o+1]=a,e}}la.prototype.bytesPerElement=4,we("StructArrayLayout2i4",la);class ca extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=o,e}}ca.prototype.bytesPerElement=6,we("StructArrayLayout3i6",ca);class is extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=o,this.int16[d+3]=u,e}}is.prototype.bytesPerElement=8,we("StructArrayLayout4i8",is);class jn extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}jn.prototype.bytesPerElement=12,we("StructArrayLayout2i4i12",jn);class qn extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.uint8[x+4]=o,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,e}}qn.prototype.bytesPerElement=8,we("StructArrayLayout2i4ub8",qn);class zs extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.float32[o+0]=r,this.float32[o+1]=a,e}}zs.prototype.bytesPerElement=8,we("StructArrayLayout2f8",zs);class Zn extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,x,b){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,a,o,u,d,f,_,x,b)}emplace(e,r,a,o,u,d,f,_,x,b,T){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=a,this.uint16[A+2]=o,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=x,this.uint16[A+8]=b,this.uint16[A+9]=T,e}}Zn.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",Zn);class Gn extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,x,b,T,A){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,a,o,u,d,f,_,x,b,T,A)}emplace(e,r,a,o,u,d,f,_,x,b,T,A,C){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=a,this.int16[P+2]=o,this.int16[P+3]=u,this.uint16[P+4]=d,this.uint16[P+5]=f,this.uint16[P+6]=_,this.uint16[P+7]=x,this.int16[P+8]=b,this.int16[P+9]=T,this.int16[P+10]=A,this.int16[P+11]=C,e}}Gn.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",Gn);class et extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}et.prototype.bytesPerElement=12,we("StructArrayLayout3f12",et);class h extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}h.prototype.bytesPerElement=4,we("StructArrayLayout1ul4",h);class t extends St{_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(e,r,a,o,u,d,f,_,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,a,o,u,d,f,_,x)}emplace(e,r,a,o,u,d,f,_,x,b){const T=10*e,A=5*e;return this.int16[T+0]=r,this.int16[T+1]=a,this.int16[T+2]=o,this.int16[T+3]=u,this.int16[T+4]=d,this.int16[T+5]=f,this.uint32[A+3]=_,this.uint16[T+8]=x,this.uint16[T+9]=b,e}}t.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",t);class s extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}s.prototype.bytesPerElement=12,we("StructArrayLayout2i2i2i12",s);class n extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,a,o,u)}emplace(e,r,a,o,u,d){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=o,this.int16[_+6]=u,this.int16[_+7]=d,e}}n.prototype.bytesPerElement=16,we("StructArrayLayout2f1f2i16",n);class l extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=a,this.float32[f+1]=o,this.float32[f+2]=u,e}}l.prototype.bytesPerElement=12,we("StructArrayLayout2ub2f12",l);class p extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=o,e}}p.prototype.bytesPerElement=6,we("StructArrayLayout3ui6",p);class m extends St{_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(e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$){const H=this.length;return this.resize(H+1),this.emplace(H,e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$)}emplace(e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$,H){const q=24*e,Y=12*e,Q=48*e;return this.int16[q+0]=r,this.int16[q+1]=a,this.uint16[q+2]=o,this.uint16[q+3]=u,this.uint32[Y+2]=d,this.uint32[Y+3]=f,this.uint32[Y+4]=_,this.uint16[q+10]=x,this.uint16[q+11]=b,this.uint16[q+12]=T,this.float32[Y+7]=A,this.float32[Y+8]=C,this.uint8[Q+36]=P,this.uint8[Q+37]=D,this.uint8[Q+38]=V,this.uint32[Y+10]=$,this.int16[q+22]=H,e}}m.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",m);class g extends St{_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(e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$,H,q,Y,Q,oe,be,Ae,xe,ye,de,Se){const me=this.length;return this.resize(me+1),this.emplace(me,e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$,H,q,Y,Q,oe,be,Ae,xe,ye,de,Se)}emplace(e,r,a,o,u,d,f,_,x,b,T,A,C,P,D,V,$,H,q,Y,Q,oe,be,Ae,xe,ye,de,Se,me){const ue=32*e,ke=16*e;return this.int16[ue+0]=r,this.int16[ue+1]=a,this.int16[ue+2]=o,this.int16[ue+3]=u,this.int16[ue+4]=d,this.int16[ue+5]=f,this.int16[ue+6]=_,this.int16[ue+7]=x,this.uint16[ue+8]=b,this.uint16[ue+9]=T,this.uint16[ue+10]=A,this.uint16[ue+11]=C,this.uint16[ue+12]=P,this.uint16[ue+13]=D,this.uint16[ue+14]=V,this.uint16[ue+15]=$,this.uint16[ue+16]=H,this.uint16[ue+17]=q,this.uint16[ue+18]=Y,this.uint16[ue+19]=Q,this.uint16[ue+20]=oe,this.uint16[ue+21]=be,this.uint16[ue+22]=Ae,this.uint32[ke+12]=xe,this.float32[ke+13]=ye,this.float32[ke+14]=de,this.uint16[ue+30]=Se,this.uint16[ue+31]=me,e}}g.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",g);class y extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}y.prototype.bytesPerElement=4,we("StructArrayLayout1f4",y);class v extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}v.prototype.bytesPerElement=12,we("StructArrayLayout1ui2f12",v);class w extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=a,this.uint16[u+3]=o,e}}w.prototype.bytesPerElement=8,we("StructArrayLayout1ul2ui8",w);class S extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.uint16[o+0]=r,this.uint16[o+1]=a,e}}S.prototype.bytesPerElement=4,we("StructArrayLayout2ui4",S);class E extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}E.prototype.bytesPerElement=2,we("StructArrayLayout1ui2",E);class B extends St{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=o,this.float32[d+3]=u,e}}B.prototype.bytesPerElement=16,we("StructArrayLayout4f16",B);class L extends ts{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 Be(this.anchorPointX,this.anchorPointY)}}L.prototype.size=20;class F extends t{get(e){return new L(this,e)}}we("CollisionBoxArray",F);class z extends ts{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}z.prototype.size=48;class G extends m{get(e){return new z(this,e)}}we("PlacedSymbolArray",G);class J extends ts{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}J.prototype.size=64;class U extends g{get(e){return new J(this,e)}}we("SymbolInstanceArray",U);class X extends y{getoffsetX(e){return this.float32[1*e+0]}}we("GlyphOffsetArray",X);class ee extends ca{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}we("SymbolLineVertexArray",ee);class te extends ts{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]}}te.prototype.size=12;class ne extends v{get(e){return new te(this,e)}}we("TextAnchorOffsetArray",ne);class he extends ts{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]}}he.prototype.size=8;class ce extends w{get(e){return new he(this,e)}}we("FeatureIndexArray",ce);class pe extends la{}class Ie extends la{}class qe extends la{}class _e extends jn{}class Le extends qn{}class Me extends zs{}class rt extends Zn{}class je extends Gn{}class Ne extends et{}class Ze extends h{}class Tt extends s{}class lt extends l{}class Zt extends p{}class Lt extends S{}const Et=xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ai}=Et;class ut{constructor(e=[]){this.segments=e}prepareSegment(e,r,a,o){let u=this.segments[this.segments.length-1];return e>ut.MAX_VERTEX_ARRAY_LENGTH&&ti(`Max vertices per segment is ${ut.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>ut.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o)&&(u={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},o!==void 0&&(u.sortKey=o),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,a,o){return new ut([{vertexOffset:e,primitiveOffset:r,vertexLength:a,primitiveLength:o,vaos:{},sortKey:0}])}}function ir(i,e){return 256*(i=Ki(Math.floor(i),0,255))+Ki(Math.floor(e),0,255)}ut.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",ut);const rr=xt([{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={exports:{}},rs={exports:{}};rs.exports=function(i,e){var r,a,o,u,d,f,_,x;for(a=i.length-(r=3&i.length),o=e,d=3432918353,f=461845907,x=0;x<a;)_=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,o=27492+(65535&(u=5*(65535&(o=(o^=_=(65535&(_=(_=(65535&_)*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:o^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return o^=i.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0};var Ds=rs.exports,Kt={exports:{}};Kt.exports=function(i,e){for(var r,a=i.length,o=e^a,u=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++u;switch(a){case 3:o^=(255&i.charCodeAt(u+2))<<16;case 2:o^=(255&i.charCodeAt(u+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(u)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var Gt=Ds,si=Kt.exports;Or.exports=Gt,Or.exports.murmur3=Gt,Or.exports.murmur2=si;var ss=ie(Or.exports);class It{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,a,o){this.ids.push(Bt(e)),this.positions.push(r,a,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Bt(e);let a=0,o=this.ids.length-1;for(;a<o;){const d=a+o>>1;this.ids[d]>=r?o=d:a=d+1}const u=[];for(;this.ids[a]===r;)u.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return u}static serialize(e,r){const a=new Float64Array(e.ids),o=new Uint32Array(e.positions);return fi(a,o,0,a.length-1),r&&r.push(a.buffer,o.buffer),{ids:a,positions:o}}static deserialize(e){const r=new It;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Bt(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ss(String(i))}function fi(i,e,r,a){for(;r<a;){const o=i[r+a>>1];let u=r-1,d=a+1;for(;;){do u++;while(i[u]<o);do d--;while(i[d]>o);if(u>=d)break;At(i,u,d),At(e,3*u,3*d),At(e,3*u+1,3*d+1),At(e,3*u+2,3*d+2)}d-r<a-d?(fi(i,e,r,d),r=d+1):(fi(i,e,d+1,a),a=d)}}function At(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}we("FeaturePositionMap",It);class as{constructor(e,r){this.gl=e.gl,this.location=r}}class Xa extends as{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Yo extends as{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Jo extends as{constructor(e,r){super(e,r),this.current=it.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Ol=new Float32Array(16);function Xn(i){return[ir(255*i.r,255*i.g),ir(255*i.b,255*i.a)]}class sr{constructor(e,r,a){this.value=e,this.uniformNames=r.map(o=>`u_${o}`),this.type=a}setUniform(e,r,a){e.set(a.constantOr(this.value))}getBinding(e,r,a){return this.type==="color"?new Jo(e,r):new Xa(e,r)}}class ns{constructor(e,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,a,o){const u=o==="u_pattern_to"?this.patternTo:o==="u_pattern_from"?this.patternFrom:o==="u_pixel_ratio_to"?this.pixelRatioTo:o==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,a){return a.substr(0,9)==="u_pattern"?new Yo(e,r):new Xa(e,r)}}class ar{constructor(e,r,a,o){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,r,a,o,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new ht(0),r,{},o,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:0},a,o);this._setPaintValue(e,r,u)}_setPaintValue(e,r,a){if(this.type==="color"){const o=Xn(a);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,o[0],o[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ni{constructor(e,r,a,o,u,d){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=a,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,a,o,u){const d=this.expression.evaluate(new ht(this.zoom),r,{},o,[],u),f=this.expression.evaluate(new ht(this.zoom+1),r,{},o,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:this.zoom},a,o),d=this.expression.evaluate({zoom:this.zoom+1},a,o);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,a,o){if(this.type==="color"){const u=Xn(a),d=Xn(o);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,a,o);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,o=Ki(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,r,a){return new Xa(e,r)}}class nr{constructor(e,r,a,o,u,d){this.expression=e,this.type=r,this.useIntegerZoom=a,this.zoom=o,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,a){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(e,r,a,o,u){this._setPaintValues(e,r,a.patterns&&a.patterns[this.layerId],u)}_setPaintValues(e,r,a,o){if(!o||!a)return;const{min:u,mid:d,max:f}=a,_=o[u],x=o[d],b=o[f];if(_&&x&&b)for(let T=e;T<r;T++)this.zoomInPaintVertexArray.emplace(T,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.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(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,rr.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,rr.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Wn{constructor(e,r,a){this.binders={},this._buffers=[];const o=[];for(const u in e.paint._values){if(!a(u))continue;const d=e.paint.get(u);if(!(d instanceof ri&&As(d.property.specification)))continue;const f=fu(u,e.type),_=d.value,x=d.property.specification.type,b=d.property.useIntegerZoom,T=d.property.specification["property-type"],A=T==="cross-faded"||T==="cross-faded-data-driven";if(_.kind==="constant")this.binders[u]=A?new ns(_.value,f):new sr(_.value,f,x),o.push(`/u_${u}`);else if(_.kind==="source"||A){const C=Ec(u,x,"source");this.binders[u]=A?new nr(_,x,b,r,C,e.id):new ar(_,f,x,C),o.push(`/a_${u}`)}else{const C=Ec(u,x,"composite");this.binders[u]=new Ni(_,f,x,b,r,C),o.push(`/z_${u}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof ar||r instanceof Ni?r.maxValue:0}populatePaintArrays(e,r,a,o,u){for(const d in this.binders){const f=this.binders[d];(f instanceof ar||f instanceof Ni||f instanceof nr)&&f.populatePaintArray(e,r,a,o,u)}}setConstantPatternPositions(e,r){for(const a in this.binders){const o=this.binders[a];o instanceof ns&&o.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,a,o,u){let d=!1;for(const f in e){const _=r.getPositions(f);for(const x of _){const b=a.feature(x.index);for(const T in this.binders){const A=this.binders[T];if((A instanceof ar||A instanceof Ni||A instanceof nr)&&A.expression.isStateDependent===!0){const C=o.paint.get(T);A.expression=C.value,A.updatePaintArray(x.start,x.end,b,e[f],u),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const a=this.binders[r];(a instanceof sr||a instanceof ns)&&e.push(...a.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof ar||a instanceof Ni)for(let o=0;o<a.paintVertexAttributes.length;o++)e.push(a.paintVertexAttributes[o].name);else if(a instanceof nr)for(let o=0;o<rr.members.length;o++)e.push(rr.members[o].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof sr||a instanceof ns||a instanceof Ni)for(const o of a.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const a=[];for(const o in this.binders){const u=this.binders[o];if(u instanceof sr||u instanceof ns||u instanceof Ni){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(e,r[d],d);a.push({name:d,property:o,binding:f})}}}return a}setUniforms(e,r,a,o){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,o,a.get(d),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(e&&a instanceof nr){const o=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(a instanceof ar||a instanceof Ni)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const r in this.binders){const a=this.binders[r];(a instanceof ar||a instanceof Ni||a instanceof nr)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof ar||r instanceof Ni||r instanceof nr)&&r.destroy()}}}class vr{constructor(e,r,a=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Wn(o,r,a);this.needsUpload=!1,this._featureMap=new It,this._bufferOffset=0}populatePaintArrays(e,r,a,o,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,o,u,d);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,a,o){for(const u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function fu(i,e){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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Ec(i,e,r){const a={color:{source:zs,composite:B},number:{source:y,composite:zs}},o=function(u){return{"line-pattern":{source:rt,composite:rt},"fill-pattern":{source:rt,composite:rt},"fill-extrusion-pattern":{source:rt,composite:rt}}[u]}(i);return o&&o[r]||a[e][r]}we("ConstantBinder",sr),we("CrossFadedConstantBinder",ns),we("SourceExpressionBinder",ar),we("CrossFadedCompositeBinder",nr),we("CompositeExpressionBinder",Ni),we("ProgramConfiguration",Wn,{omit:["_buffers"]}),we("ProgramConfigurationSet",vr);const zt=8192,Vl=Math.pow(2,14)-1,Cc=-Vl-1;function ha(i){const e=zt/i.extent,r=i.loadGeometry();for(let a=0;a<r.length;a++){const o=r[a];for(let u=0;u<o.length;u++){const d=o[u],f=Math.round(d.x*e),_=Math.round(d.y*e);d.x=Ki(f,Cc,Vl),d.y=Ki(_,Cc,Vl),(f<d.x||f>d.x+1||_<d.y||_>d.y+1)&&ti("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ua(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?ha(i):[]}}function Qo(i,e,r,a,o){i.emplaceBack(2*e+(a+1)/2,2*r+(o+1)/2)}class Nl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ie,this.indexArray=new Zt,this.segments=new ut,this.programConfigurations=new vr(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){const o=this.layers[0],u=[];let d=null,f=!1;o.type==="circle"&&(d=o.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:_,id:x,index:b,sourceLayerIndex:T}of e){const A=this.layers[0]._featureFilter.needGeometry,C=ua(_,A);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),C,a))continue;const P=f?d.evaluate(C,{},a):void 0,D={id:x,properties:_.properties,type:_.type,sourceLayerIndex:T,index:b,geometry:A?C.geometry:ha(_),patterns:{},sortKey:P};u.push(D)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of u){const{geometry:x,index:b,sourceLayerIndex:T}=_,A=e[b].feature;this.addFeature(_,x,b,a),r.featureIndex.insert(A,x,b,T,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ai),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,a,o){for(const u of r)for(const d of u){const f=d.x,_=d.y;if(f<0||f>=zt||_<0||_>=zt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=x.vertexLength;Qo(this.layoutVertexArray,f,_,-1,-1),Qo(this.layoutVertexArray,f,_,1,-1),Qo(this.layoutVertexArray,f,_,1,1),Qo(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{},o)}}function Pc(i,e){for(let r=0;r<i.length;r++)if(Wa(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Wa(i,e[r]))return!0;return!!Ul(i,e)}function mu(i,e,r){return!!Wa(i,e)||!!$l(e,i,r)}function kc(i,e){if(i.length===1)return Dc(e,i[0]);for(let r=0;r<e.length;r++){const a=e[r];for(let o=0;o<a.length;o++)if(Wa(i,a[o]))return!0}for(let r=0;r<i.length;r++)if(Dc(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ul(i,e[r]))return!0;return!1}function gu(i,e,r){if(i.length>1){if(Ul(i,e))return!0;for(let a=0;a<e.length;a++)if($l(e[a],i,r))return!0}for(let a=0;a<i.length;a++)if($l(i[a],e,r))return!0;return!1}function Ul(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const a=i[r],o=i[r+1];for(let u=0;u<e.length-1;u++)if(_u(a,o,e[u],e[u+1]))return!0}return!1}function _u(i,e,r,a){return vi(i,r,a)!==vi(e,r,a)&&vi(i,e,r)!==vi(i,e,a)}function $l(i,e,r){const a=r*r;if(e.length===1)return i.distSqr(e[0])<a;for(let o=1;o<e.length;o++)if(zc(i,e[o-1],e[o])<a)return!0;return!1}function zc(i,e,r){const a=e.distSqr(r);if(a===0)return i.distSqr(e);const o=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/a;return i.distSqr(o<0?e:o>1?r:r.sub(e)._mult(o)._add(e))}function Dc(i,e){let r,a,o,u=!1;for(let d=0;d<i.length;d++){r=i[d];for(let f=0,_=r.length-1;f<r.length;_=f++)a=r[f],o=r[_],a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(u=!u)}return u}function Wa(i,e){let r=!1;for(let a=0,o=i.length-1;a<i.length;o=a++){const u=i[a],d=i[o];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function yu(i,e,r){const a=r[0],o=r[2];if(i.x<a.x&&e.x<a.x||i.x>o.x&&e.x>o.x||i.y<a.y&&e.y<a.y||i.y>o.y&&e.y>o.y)return!1;const u=vi(i,e,r[0]);return u!==vi(i,e,r[1])||u!==vi(i,e,r[2])||u!==vi(i,e,r[3])}function Hn(i,e,r){const a=e.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(e.id).getMaxValue(i)}function el(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function tl(i,e,r,a,o){if(!e[0]&&!e[1])return i;const u=Be.convert(e)._mult(o);r==="viewport"&&u._rotate(-a);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let Lc,Bc;we("CircleBucket",Nl,{omit:["layers"]});var xu={get paint(){return Bc=Bc||new Mt({"circle-radius":new De(re.paint_circle["circle-radius"]),"circle-color":new De(re.paint_circle["circle-color"]),"circle-blur":new De(re.paint_circle["circle-blur"]),"circle-opacity":new De(re.paint_circle["circle-opacity"]),"circle-translate":new Ce(re.paint_circle["circle-translate"]),"circle-translate-anchor":new Ce(re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ce(re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ce(re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new De(re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new De(re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new De(re.paint_circle["circle-stroke-opacity"])})},get layout(){return Lc=Lc||new Mt({"circle-sort-key":new De(re.layout_circle["circle-sort-key"])})}},mi=1e-6,Ha=typeof Float32Array<"u"?Float32Array:Array;function jl(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Rc(i,e,r){var a=e[0],o=e[1],u=e[2],d=e[3],f=e[4],_=e[5],x=e[6],b=e[7],T=e[8],A=e[9],C=e[10],P=e[11],D=e[12],V=e[13],$=e[14],H=e[15],q=r[0],Y=r[1],Q=r[2],oe=r[3];return i[0]=q*a+Y*f+Q*T+oe*D,i[1]=q*o+Y*_+Q*A+oe*V,i[2]=q*u+Y*x+Q*C+oe*$,i[3]=q*d+Y*b+Q*P+oe*H,i[4]=(q=r[4])*a+(Y=r[5])*f+(Q=r[6])*T+(oe=r[7])*D,i[5]=q*o+Y*_+Q*A+oe*V,i[6]=q*u+Y*x+Q*C+oe*$,i[7]=q*d+Y*b+Q*P+oe*H,i[8]=(q=r[8])*a+(Y=r[9])*f+(Q=r[10])*T+(oe=r[11])*D,i[9]=q*o+Y*_+Q*A+oe*V,i[10]=q*u+Y*x+Q*C+oe*$,i[11]=q*d+Y*b+Q*P+oe*H,i[12]=(q=r[12])*a+(Y=r[13])*f+(Q=r[14])*T+(oe=r[15])*D,i[13]=q*o+Y*_+Q*A+oe*V,i[14]=q*u+Y*x+Q*C+oe*$,i[15]=q*d+Y*b+Q*P+oe*H,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Kn,vu=Rc;function il(i,e,r){var a=e[0],o=e[1],u=e[2],d=e[3];return i[0]=r[0]*a+r[4]*o+r[8]*u+r[12]*d,i[1]=r[1]*a+r[5]*o+r[9]*u+r[13]*d,i[2]=r[2]*a+r[6]*o+r[10]*u+r[14]*d,i[3]=r[3]*a+r[7]*o+r[11]*u+r[15]*d,i}Kn=new Ha(4),Ha!=Float32Array&&(Kn[0]=0,Kn[1]=0,Kn[2]=0,Kn[3]=0);class bu extends Vi{constructor(e){super(e,xu)}createBucket(e){return new Nl(e)}queryRadius(e){const r=e;return Hn("circle-radius",this,r)+Hn("circle-stroke-width",this,r)+el(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f,_){const x=tl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),b=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),T=this.paint.get("circle-pitch-alignment")==="map",A=T?x:function(P,D){return P.map(V=>Fc(V,D))}(x,_),C=T?b*f:b;for(const P of o)for(const D of P){const V=T?D:Fc(D,_);let $=C;const H=il([],[D.x,D.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=H[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/H[3]),mu(A,V,$))return!0}return!1}}function Fc(i,e){const r=il([],[i.x,i.y,0,1],e);return new Be(r[0]/r[3],r[1]/r[3])}class Oc extends Nl{}let Vc;we("HeatmapBucket",Oc,{omit:["layers"]});var wu={get paint(){return Vc=Vc||new Mt({"heatmap-radius":new De(re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new De(re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ce(re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Un(re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ce(re.paint_heatmap["heatmap-opacity"])})}};function ql(i,{width:e,height:r},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*r*a)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*r*a}`)}else o=new Uint8Array(e*r*a);return i.width=e,i.height=r,i.data=o,i}function Nc(i,{width:e,height:r},a){if(e===i.width&&r===i.height)return;const o=ql({},{width:e,height:r},a);Zl(i,o,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},a),i.width=e,i.height=r,i.data=o.data}function Zl(i,e,r,a,o,u){if(o.width===0||o.height===0)return e;if(o.width>i.width||o.height>i.height||r.x>i.width-o.width||r.y>i.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||a.x>e.width-o.width||a.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<o.height;_++){const x=((r.y+_)*i.width+r.x)*u,b=((a.y+_)*e.width+a.x)*u;for(let T=0;T<o.width*u;T++)f[b+T]=d[x+T]}return e}class Yn{constructor(e,r){ql(this,e,1,r)}resize(e){Nc(this,e,1)}clone(){return new Yn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){Zl(e,r,a,o,u,1)}}class qi{constructor(e,r){ql(this,e,4,r)}resize(e){Nc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new qi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){Zl(e,r,a,o,u,4)}}function Uc(i){const e={},r=i.resolution||256,a=i.clips?i.clips.length:1,o=i.image||new qi({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,_)=>{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);o.data[d+f+0]=Math.floor(255*x.r/x.a),o.data[d+f+1]=Math.floor(255*x.g/x.a),o.data[d+f+2]=Math.floor(255*x.b/x.a),o.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d<a;++d,f+=4*r)for(let _=0,x=0;_<r;_++,x+=4){const b=_/(r-1),{start:T,end:A}=i.clips[d];u(f,x,T*(1-b)+A*b)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return o}we("AlphaImage",Yn),we("RGBAImage",qi);class Su extends Vi{createBucket(e){return new Oc(e)}constructor(e){super(e,wu),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Uc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let $c;var Tu={get paint(){return $c=$c||new Mt({"hillshade-illumination-direction":new Ce(re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ce(re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ce(re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ce(re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ce(re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ce(re.paint_hillshade["hillshade-accent-color"])})}};class Iu extends Vi{constructor(e){super(e,Tu)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Au=xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Mu}=Au;var Gl={exports:{}};function rl(i,e,r){r=r||2;var a,o,u,d,f,_,x,b=e&&e.length,T=b?e[0]*r:i.length,A=jc(i,0,T,r,!0),C=[];if(!A||A.next===A.prev)return C;if(b&&(A=function(D,V,$,H){var q,Y,Q,oe=[];for(q=0,Y=V.length;q<Y;q++)(Q=jc(D,V[q]*H,q<Y-1?V[q+1]*H:D.length,H,!1))===Q.next&&(Q.steiner=!0),oe.push(Bu(Q));for(oe.sort(zu),q=0;q<oe.length;q++)$=Du(oe[q],$);return $}(i,e,A,r)),i.length>80*r){a=u=i[0],o=d=i[1];for(var P=r;P<T;P+=r)(f=i[P])<a&&(a=f),(_=i[P+1])<o&&(o=_),f>u&&(u=f),_>d&&(d=_);x=(x=Math.max(u-a,d-o))!==0?32767/x:0}return Jn(A,C,r,a,o,x,0),C}function jc(i,e,r,a,o){var u,d;if(o===Hl(i,e,r,a)>0)for(u=e;u<r;u+=a)d=Gc(u,i[u],i[u+1],d);else for(u=r-a;u>=e;u-=a)d=Gc(u,i[u],i[u+1],d);return d&&sl(d,d.next)&&(eo(d),d=d.next),d}function pa(i,e){if(!i)return i;e||(e=i);var r,a=i;do if(r=!1,a.steiner||!sl(a,a.next)&&Ct(a.prev,a,a.next)!==0)a=a.next;else{if(eo(a),(a=e=a.prev)===a.next)break;r=!0}while(r||a!==e);return e}function Jn(i,e,r,a,o,u,d){if(i){!d&&u&&function(b,T,A,C){var P=b;do P.z===0&&(P.z=Xl(P.x,P.y,T,A,C)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==b);P.prevZ.nextZ=null,P.prevZ=null,function(D){var V,$,H,q,Y,Q,oe,be,Ae=1;do{for($=D,D=null,Y=null,Q=0;$;){for(Q++,H=$,oe=0,V=0;V<Ae&&(oe++,H=H.nextZ);V++);for(be=Ae;oe>0||be>0&&H;)oe!==0&&(be===0||!H||$.z<=H.z)?(q=$,$=$.nextZ,oe--):(q=H,H=H.nextZ,be--),Y?Y.nextZ=q:D=q,q.prevZ=Y,Y=q;$=H}Y.nextZ=null,Ae*=2}while(Q>1)}(P)}(i,a,o,u);for(var f,_,x=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?Cu(i,a,o,u):Eu(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),eo(i),i=_.next,x=_.next;else if((i=_)===x){d?d===1?Jn(i=Pu(pa(i),e,r),e,r,a,o,u,2):d===2&&ku(i,e,r,a,o,u):Jn(pa(i),e,r,a,o,u,1);break}}}function Eu(i){var e=i.prev,r=i,a=i.next;if(Ct(e,r,a)>=0)return!1;for(var o=e.x,u=r.x,d=a.x,f=e.y,_=r.y,x=a.y,b=o<u?o<d?o:d:u<d?u:d,T=f<_?f<x?f:x:_<x?_:x,A=o>u?o>d?o:d:u>d?u:d,C=f>_?f>x?f:x:_>x?_:x,P=a.next;P!==e;){if(P.x>=b&&P.x<=A&&P.y>=T&&P.y<=C&&Ka(o,f,u,_,d,x,P.x,P.y)&&Ct(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function Cu(i,e,r,a){var o=i.prev,u=i,d=i.next;if(Ct(o,u,d)>=0)return!1;for(var f=o.x,_=u.x,x=d.x,b=o.y,T=u.y,A=d.y,C=f<_?f<x?f:x:_<x?_:x,P=b<T?b<A?b:A:T<A?T:A,D=f>_?f>x?f:x:_>x?_:x,V=b>T?b>A?b:A:T>A?T:A,$=Xl(C,P,e,r,a),H=Xl(D,V,e,r,a),q=i.prevZ,Y=i.nextZ;q&&q.z>=$&&Y&&Y.z<=H;){if(q.x>=C&&q.x<=D&&q.y>=P&&q.y<=V&&q!==o&&q!==d&&Ka(f,b,_,T,x,A,q.x,q.y)&&Ct(q.prev,q,q.next)>=0||(q=q.prevZ,Y.x>=C&&Y.x<=D&&Y.y>=P&&Y.y<=V&&Y!==o&&Y!==d&&Ka(f,b,_,T,x,A,Y.x,Y.y)&&Ct(Y.prev,Y,Y.next)>=0))return!1;Y=Y.nextZ}for(;q&&q.z>=$;){if(q.x>=C&&q.x<=D&&q.y>=P&&q.y<=V&&q!==o&&q!==d&&Ka(f,b,_,T,x,A,q.x,q.y)&&Ct(q.prev,q,q.next)>=0)return!1;q=q.prevZ}for(;Y&&Y.z<=H;){if(Y.x>=C&&Y.x<=D&&Y.y>=P&&Y.y<=V&&Y!==o&&Y!==d&&Ka(f,b,_,T,x,A,Y.x,Y.y)&&Ct(Y.prev,Y,Y.next)>=0)return!1;Y=Y.nextZ}return!0}function Pu(i,e,r){var a=i;do{var o=a.prev,u=a.next.next;!sl(o,u)&&qc(o,a,a.next,u)&&Qn(o,u)&&Qn(u,o)&&(e.push(o.i/r|0),e.push(a.i/r|0),e.push(u.i/r|0),eo(a),eo(a.next),a=i=u),a=a.next}while(a!==i);return pa(a)}function ku(i,e,r,a,o,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Ru(d,f)){var _=Zc(d,f);return d=pa(d,d.next),_=pa(_,_.next),Jn(d,e,r,a,o,u,0),void Jn(_,e,r,a,o,u,0)}f=f.next}d=d.next}while(d!==i)}function zu(i,e){return i.x-e.x}function Du(i,e){var r=function(o,u){var d,f=u,_=o.x,x=o.y,b=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var T=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(T<=_&&T>b&&(b=T,d=f.x<f.next.x?f:f.next,T===_))return d}f=f.next}while(f!==u);if(!d)return null;var A,C=d,P=d.x,D=d.y,V=1/0;f=d;do _>=f.x&&f.x>=P&&_!==f.x&&Ka(x<D?_:b,x,P,D,x<D?b:_,x,f.x,f.y)&&(A=Math.abs(x-f.y)/(_-f.x),Qn(f,o)&&(A<V||A===V&&(f.x>d.x||f.x===d.x&&Lu(d,f)))&&(d=f,V=A)),f=f.next;while(f!==C);return d}(i,e);if(!r)return e;var a=Zc(r,i);return pa(a,a.next),pa(r,r.next)}function Lu(i,e){return Ct(i.prev,i,e.prev)<0&&Ct(e.next,i,i.next)<0}function Xl(i,e,r,a,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bu(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Ka(i,e,r,a,o,u,d,f){return(o-d)*(e-f)>=(i-d)*(u-f)&&(i-d)*(a-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(o-d)*(a-f)}function Ru(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,a){var o=r;do{if(o.i!==r.i&&o.next.i!==r.i&&o.i!==a.i&&o.next.i!==a.i&&qc(o,o.next,r,a))return!0;o=o.next}while(o!==r);return!1}(i,e)&&(Qn(i,e)&&Qn(e,i)&&function(r,a){var o=r,u=!1,d=(r.x+a.x)/2,f=(r.y+a.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&d<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==r);return u}(i,e)&&(Ct(i.prev,i,e.prev)||Ct(i,e.prev,e))||sl(i,e)&&Ct(i.prev,i,i.next)>0&&Ct(e.prev,e,e.next)>0)}function Ct(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function sl(i,e){return i.x===e.x&&i.y===e.y}function qc(i,e,r,a){var o=nl(Ct(i,e,r)),u=nl(Ct(i,e,a)),d=nl(Ct(r,a,i)),f=nl(Ct(r,a,e));return o!==u&&d!==f||!(o!==0||!al(i,r,e))||!(u!==0||!al(i,a,e))||!(d!==0||!al(r,i,a))||!(f!==0||!al(r,e,a))}function al(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function nl(i){return i>0?1:i<0?-1:0}function Qn(i,e){return Ct(i.prev,i,i.next)<0?Ct(i,e,i.next)>=0&&Ct(i,i.prev,e)>=0:Ct(i,e,i.prev)<0||Ct(i,i.next,e)<0}function Zc(i,e){var r=new Wl(i.i,i.x,i.y),a=new Wl(e.i,e.x,e.y),o=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=o,o.prev=r,a.next=r,r.prev=a,u.next=a,a.prev=u,a}function Gc(i,e,r,a){var o=new Wl(i,e,r);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function eo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Wl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Hl(i,e,r,a){for(var o=0,u=e,d=r-a;u<r;u+=a)o+=(i[d]-i[u])*(i[u+1]+i[d+1]),d=u;return o}Gl.exports=rl,Gl.exports.default=rl,rl.deviation=function(i,e,r,a){var o=e&&e.length,u=Math.abs(Hl(i,0,o?e[0]*r:i.length,r));if(o)for(var d=0,f=e.length;d<f;d++)u-=Math.abs(Hl(i,e[d]*r,d<f-1?e[d+1]*r:i.length,r));var _=0;for(d=0;d<a.length;d+=3){var x=a[d]*r,b=a[d+1]*r,T=a[d+2]*r;_+=Math.abs((i[x]-i[T])*(i[b+1]-i[x+1])-(i[x]-i[b])*(i[T+1]-i[x+1]))}return u===0&&_===0?0:Math.abs((_-u)/u)},rl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,o=0;o<i.length;o++){for(var u=0;u<i[o].length;u++)for(var d=0;d<e;d++)r.vertices.push(i[o][u][d]);o>0&&r.holes.push(a+=i[o-1].length)}return r};var Xc=ie(Gl.exports);function Fu(i,e,r,a,o){Wc(i,e,r||0,a||i.length-1,o||Ou)}function Wc(i,e,r,a,o){for(;a>r;){if(a-r>600){var u=a-r+1,d=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);Wc(i,e,Math.max(r,Math.floor(e-d*_/u+x)),Math.min(a,Math.floor(e+(u-d)*_/u+x)),o)}var b=i[e],T=r,A=a;for(to(i,r,e),o(i[a],b)>0&&to(i,r,a);T<A;){for(to(i,T,A),T++,A--;o(i[T],b)<0;)T++;for(;o(i[A],b)>0;)A--}o(i[r],b)===0?to(i,r,A):to(i,++A,a),A<=e&&(r=A+1),e<=A&&(a=A-1)}}function to(i,e,r){var a=i[e];i[e]=i[r],i[r]=a}function Ou(i,e){return i<e?-1:i>e?1:0}function Kl(i,e){const r=i.length;if(r<=1)return[i];const a=[];let o,u;for(let d=0;d<r;d++){const f=hr(i[d]);f!==0&&(i[d].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(o&&a.push(o),o=[i[d]]):o.push(i[d]))}if(o&&a.push(o),e>1)for(let d=0;d<a.length;d++)a[d].length<=e||(Fu(a[d],e,1,a[d].length-1,Vu),a[d]=a[d].slice(0,e));return a}function Vu(i,e){return e.area-i.area}function Yl(i,e,r){const a=r.patternDependencies;let o=!1;for(const u of e){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(o=!0);const f=d.constantOr(null);f&&(o=!0,a[f.to]=!0,a[f.from]=!0)}return o}function Jl(i,e,r,a,o){const u=o.patternDependencies;for(const d of e){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let _=f.evaluate({zoom:a-1},r,{},o.availableImages),x=f.evaluate({zoom:a},r,{},o.availableImages),b=f.evaluate({zoom:a+1},r,{},o.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,b=b&&b.name?b.name:b,u[_]=!0,u[x]=!0,u[b]=!0,r.patterns[d.id]={min:_,mid:x,max:b}}}return r}class Ql{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new qe,this.indexArray=new Zt,this.indexArray2=new Lt,this.programConfigurations=new vr(e.layers,e.zoom),this.segments=new ut,this.segments2=new ut,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Yl("fill",this.layers,r);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const T=this.layers[0]._featureFilter.needGeometry,A=ua(f,T);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,a))continue;const C=u?o.evaluate(A,{},a,r.availableImages):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:T?A.geometry:ha(f),patterns:{},sortKey:C};d.push(P)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const T=Jl("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,_,x,a,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,a,o,u){for(const d of Kl(r,500)){let f=0;for(const C of d)f+=C.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,b=[],T=[];for(const C of d){if(C.length===0)continue;C!==d[0]&&T.push(b.length/2);const P=this.segments2.prepareSegment(C.length,this.layoutVertexArray,this.indexArray2),D=P.vertexLength;this.layoutVertexArray.emplaceBack(C[0].x,C[0].y),this.indexArray2.emplaceBack(D+C.length-1,D),b.push(C[0].x),b.push(C[0].y);for(let V=1;V<C.length;V++)this.layoutVertexArray.emplaceBack(C[V].x,C[V].y),this.indexArray2.emplaceBack(D+V-1,D+V),b.push(C[V].x),b.push(C[V].y);P.vertexLength+=C.length,P.primitiveLength+=C.length}const A=Xc(b,T);for(let C=0;C<A.length;C+=3)this.indexArray.emplaceBack(x+A[C],x+A[C+1],x+A[C+2]);_.vertexLength+=f,_.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}let Hc,Kc;we("FillBucket",Ql,{omit:["layers","patternFeatures"]});var Nu={get paint(){return Kc=Kc||new Mt({"fill-antialias":new Ce(re.paint_fill["fill-antialias"]),"fill-opacity":new De(re.paint_fill["fill-opacity"]),"fill-color":new De(re.paint_fill["fill-color"]),"fill-outline-color":new De(re.paint_fill["fill-outline-color"]),"fill-translate":new Ce(re.paint_fill["fill-translate"]),"fill-translate-anchor":new Ce(re.paint_fill["fill-translate-anchor"]),"fill-pattern":new oa(re.paint_fill["fill-pattern"])})},get layout(){return Hc=Hc||new Mt({"fill-sort-key":new De(re.layout_fill["fill-sort-key"])})}};class Uu extends Vi{constructor(e){super(e,Nu)}recalculate(e,r){super.recalculate(e,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Ql(e)}queryRadius(){return el(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f){return kc(tl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),o)}isTileClipped(){return!0}}const $u=xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ju=xt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:qu}=$u;var Ls={},Zu=Hi,Yc=Ya;function Ya(i,e,r,a,o){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=o,i.readFields(Gu,this,e)}function Gu(i,e,r){i==1?e.id=r.readVarint():i==2?function(a,o){for(var u=a.readVarint()+a.pos;a.pos<u;){var d=o._keys[a.readVarint()],f=o._values[a.readVarint()];o.properties[d]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function Xu(i){for(var e,r,a=0,o=0,u=i.length,d=u-1;o<u;d=o++)a+=((r=i[d]).x-(e=i[o]).x)*(e.y+r.y);return a}Ya.types=["Unknown","Point","LineString","Polygon"],Ya.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,a=1,o=0,u=0,d=0,f=[];i.pos<r;){if(o<=0){var _=i.readVarint();a=7&_,o=_>>3}if(o--,a===1||a===2)u+=i.readSVarint(),d+=i.readSVarint(),a===1&&(e&&f.push(e),e=[]),e.push(new Zu(u,d));else{if(a!==7)throw new Error("unknown command "+a);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Ya.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,a=0,o=0,u=0,d=1/0,f=-1/0,_=1/0,x=-1/0;i.pos<e;){if(a<=0){var b=i.readVarint();r=7&b,a=b>>3}if(a--,r===1||r===2)(o+=i.readSVarint())<d&&(d=o),o>f&&(f=o),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,x]},Ya.prototype.toGeoJSON=function(i,e,r){var a,o,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=Ya.types[this.type];function b(C){for(var P=0;P<C.length;P++){var D=C[P];C[P]=[360*(D.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(D.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var T=[];for(a=0;a<_.length;a++)T[a]=_[a][0];b(_=T);break;case 2:for(a=0;a<_.length;a++)b(_[a]);break;case 3:for(_=function(C){var P=C.length;if(P<=1)return[C];for(var D,V,$=[],H=0;H<P;H++){var q=Xu(C[H]);q!==0&&(V===void 0&&(V=q<0),V===q<0?(D&&$.push(D),D=[C[H]]):D.push(C[H]))}return D&&$.push(D),$}(_),a=0;a<_.length;a++)for(o=0;o<_[a].length;o++)b(_[a][o])}_.length===1?_=_[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(A.id=this.id),A};var Wu=Yc,Jc=Qc;function Qc(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Hu,this,e),this.length=this._features.length}function Hu(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(a){for(var o=null,u=a.readVarint()+a.pos;a.pos<u;){var d=a.readVarint()>>3;o=d===1?a.readString():d===2?a.readFloat():d===3?a.readDouble():d===4?a.readVarint64():d===5?a.readVarint():d===6?a.readSVarint():d===7?a.readBoolean():null}return o}(r))}Qc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Wu(this._pbf,e,this.extent,this._keys,this._values)};var Ku=Jc;function Yu(i,e,r){if(i===3){var a=new Ku(r,r.readVarint()+r.pos);a.length&&(e[a.name]=a)}}Ls.VectorTile=function(i,e){this.layers=i.readFields(Yu,{},e)},Ls.VectorTileFeature=Yc,Ls.VectorTileLayer=Jc;const Ju=Ls.VectorTileFeature.types,ec=Math.pow(2,13);function io(i,e,r,a,o,u,d,f){i.emplaceBack(e,r,2*Math.floor(a*ec)+d,o*ec*2,u*ec*2,Math.round(f))}class tc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new _e,this.centroidVertexArray=new pe,this.indexArray=new Zt,this.programConfigurations=new vr(e.layers,e.zoom),this.segments=new ut,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.features=[],this.hasPattern=Yl("fill-extrusion",this.layers,r);for(const{feature:o,id:u,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=ua(o,_);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),x,a))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:_?x.geometry:ha(o),properties:o.properties,type:o.type,patterns:{}};this.hasPattern?this.features.push(Jl("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,a,{}),r.featureIndex.insert(o,b.geometry,d,f,this.index,!0)}}addFeatures(e,r,a){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,r,a)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qu),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ju.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,a,o,u){const d={x:0,y:0,vertexCount:0};for(const f of Kl(r,500)){let _=0;for(const P of f)_+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of f){if(P.length===0||ep(P))continue;let D=0;for(let V=0;V<P.length;V++){const $=P[V];if(V>=1){const H=P[V-1];if(!Qu($,H)){x.vertexLength+4>ut.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const q=$.sub(H)._perp()._unit(),Y=H.dist($);D+Y>32768&&(D=0),io(this.layoutVertexArray,$.x,$.y,q.x,q.y,0,0,D),io(this.layoutVertexArray,$.x,$.y,q.x,q.y,0,1,D),d.x+=2*$.x,d.y+=2*$.y,d.vertexCount+=2,D+=Y,io(this.layoutVertexArray,H.x,H.y,q.x,q.y,0,0,D),io(this.layoutVertexArray,H.x,H.y,q.x,q.y,0,1,D),d.x+=2*H.x,d.y+=2*H.y,d.vertexCount+=2;const Q=x.vertexLength;this.indexArray.emplaceBack(Q,Q+2,Q+1),this.indexArray.emplaceBack(Q+1,Q+2,Q+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>ut.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Ju[e.type]!=="Polygon")continue;const b=[],T=[],A=x.vertexLength;for(const P of f)if(P.length!==0){P!==f[0]&&T.push(b.length/2);for(let D=0;D<P.length;D++){const V=P[D];io(this.layoutVertexArray,V.x,V.y,0,0,1,1,0),d.x+=V.x,d.y+=V.y,d.vertexCount+=1,b.push(V.x),b.push(V.y)}}const C=Xc(b,T);for(let P=0;P<C.length;P+=3)this.indexArray.emplaceBack(A+C[P],A+C[P+2],A+C[P+1]);x.primitiveLength+=C.length/3,x.vertexLength+=_}for(let f=0;f<d.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}function Qu(i,e){return i.x===e.x&&(i.x<0||i.x>zt)||i.y===e.y&&(i.y<0||i.y>zt)}function ep(i){return i.every(e=>e.x<0)||i.every(e=>e.x>zt)||i.every(e=>e.y<0)||i.every(e=>e.y>zt)}let eh;we("FillExtrusionBucket",tc,{omit:["layers","features"]});var tp={get paint(){return eh=eh||new Mt({"fill-extrusion-opacity":new Ce(re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new De(re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ce(re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ce(re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new oa(re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new De(re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new De(re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ce(re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ip extends Vi{constructor(e){super(e,tp)}createBucket(e){return new tc(e)}queryRadius(){return el(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,a,o,u,d,f,_){const x=tl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),b=this.paint.get("fill-extrusion-height").evaluate(r,a),T=this.paint.get("fill-extrusion-base").evaluate(r,a),A=function(P,D,V,$){const H=[];for(const q of P){const Y=[q.x,q.y,0,1];il(Y,Y,D),H.push(new Be(Y[0]/Y[3],Y[1]/Y[3]))}return H}(x,_),C=function(P,D,V,$){const H=[],q=[],Y=$[8]*D,Q=$[9]*D,oe=$[10]*D,be=$[11]*D,Ae=$[8]*V,xe=$[9]*V,ye=$[10]*V,de=$[11]*V;for(const Se of P){const me=[],ue=[];for(const ke of Se){const Ee=ke.x,$e=ke.y,pt=$[0]*Ee+$[4]*$e+$[12],ft=$[1]*Ee+$[5]*$e+$[13],Ft=$[2]*Ee+$[6]*$e+$[14],Ui=$[3]*Ee+$[7]*$e+$[15],gi=Ft+oe,Dt=Ui+be,Xt=pt+Ae,Jt=ft+xe,_i=Ft+ye,yi=Ui+de,Ot=new Be((pt+Y)/Dt,(ft+Q)/Dt);Ot.z=gi/Dt,me.push(Ot);const Vt=new Be(Xt/yi,Jt/yi);Vt.z=_i/yi,ue.push(Vt)}H.push(me),q.push(ue)}return[H,q]}(o,T,b,_);return function(P,D,V){let $=1/0;kc(V,D)&&($=th(V,D[0]));for(let H=0;H<D.length;H++){const q=D[H],Y=P[H];for(let Q=0;Q<q.length-1;Q++){const oe=q[Q],be=[oe,q[Q+1],Y[Q+1],Y[Q],oe];Pc(V,be)&&($=Math.min($,th(V,be)))}}return $!==1/0&&$}(C[0],C[1],A)}}function ro(i,e){return i.x*e.x+i.y*e.y}function th(i,e){if(i.length===1){let r=0;const a=e[r++];let o;for(;!o||a.equals(o);)if(o=e[r++],!o)return 1/0;for(;r<e.length;r++){const u=e[r],d=i[0],f=o.sub(a),_=u.sub(a),x=d.sub(a),b=ro(f,f),T=ro(f,_),A=ro(_,_),C=ro(x,f),P=ro(x,_),D=b*A-T*T,V=(A*C-T*P)/D,$=(b*P-T*C)/D,H=a.z*(1-V-$)+o.z*V+u.z*$;if(isFinite(H))return H}return 1/0}{let r=1/0;for(const a of e)r=Math.min(r,a.z);return r}}const rp=xt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:sp}=rp,ap=xt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:np}=ap,op=Ls.VectorTileFeature.types,lp=Math.cos(Math.PI/180*37.5),ih=Math.pow(2,14)/.5;class ic{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Le,this.layoutVertexArray2=new Me,this.indexArray=new Zt,this.programConfigurations=new vr(e.layers,e.zoom),this.segments=new ut,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Yl("line",this.layers,r);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const T=this.layers[0]._featureFilter.needGeometry,A=ua(f,T);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,a))continue;const C=u?o.evaluate(A,{},a):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:T?A.geometry:ha(f),patterns:{},sortKey:C};d.push(P)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const T=Jl("line",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,_,x,a,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,np)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sp),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,a,o,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),_=d.get("line-cap"),x=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const T of r)this.addLine(T,e,f,_,x,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}addLine(e,r,a,o,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$<e.length-1;$++)this.totalDistance+=e[$].dist(e[$+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=op[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;a==="bevel"&&(u=1.05);const b=this.overscaling<=16?15*zt/(512*this.overscaling):0,T=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,C,P,D,V;this.e1=this.e2=-1,f&&(A=e[_-2],V=e[x].sub(A)._unit()._perp());for(let $=x;$<_;$++){if(P=$===_-1?f?e[x+1]:void 0:e[$+1],P&&e[$].equals(P))continue;V&&(D=V),A&&(C=A),A=e[$],V=P?P.sub(A)._unit()._perp():D,D=D||V;let H=D.add(V);H.x===0&&H.y===0||H._unit();const q=D.x*V.x+D.y*V.y,Y=H.x*V.x+H.y*V.y,Q=Y!==0?1/Y:1/0,oe=2*Math.sqrt(2-2*Y),be=Y<lp&&C&&P,Ae=D.x*V.y-D.y*V.x>0;if(be&&$>x){const de=A.dist(C);if(de>2*b){const Se=A.sub(A.sub(C)._mult(b/de)._round());this.updateDistance(C,Se),this.addCurrentVertex(Se,D,0,0,T),C=Se}}const xe=C&&P;let ye=xe?a:f?"butt":o;if(xe&&ye==="round"&&(Q<d?ye="miter":Q<=2&&(ye="fakeround")),ye==="miter"&&Q>u&&(ye="bevel"),ye==="bevel"&&(Q>2&&(ye="flipbevel"),Q<u&&(ye="miter")),C&&this.updateDistance(C,A),ye==="miter")H._mult(Q),this.addCurrentVertex(A,H,0,0,T);else if(ye==="flipbevel"){if(Q>100)H=V.mult(-1);else{const de=Q*D.add(V).mag()/D.sub(V).mag();H._perp()._mult(de*(Ae?-1:1))}this.addCurrentVertex(A,H,0,0,T),this.addCurrentVertex(A,H.mult(-1),0,0,T)}else if(ye==="bevel"||ye==="fakeround"){const de=-Math.sqrt(Q*Q-1),Se=Ae?de:0,me=Ae?0:de;if(C&&this.addCurrentVertex(A,D,Se,me,T),ye==="fakeround"){const ue=Math.round(180*oe/Math.PI/20);for(let ke=1;ke<ue;ke++){let Ee=ke/ue;if(Ee!==.5){const pt=Ee-.5;Ee+=Ee*pt*(Ee-1)*((1.0904+q*(q*(3.55645-1.43519*q)-3.2452))*pt*pt+(.848013+q*(.215638*q-1.06021)))}const $e=V.sub(D)._mult(Ee)._add(D)._unit()._mult(Ae?-1:1);this.addHalfVertex(A,$e.x,$e.y,!1,Ae,0,T)}}P&&this.addCurrentVertex(A,V,-Se,-me,T)}else if(ye==="butt")this.addCurrentVertex(A,H,0,0,T);else if(ye==="square"){const de=C?1:-1;this.addCurrentVertex(A,H,de,de,T)}else ye==="round"&&(C&&(this.addCurrentVertex(A,D,0,0,T),this.addCurrentVertex(A,D,1,1,T,!0)),P&&(this.addCurrentVertex(A,V,-1,-1,T,!0),this.addCurrentVertex(A,V,0,0,T)));if(be&&$<_-1){const de=A.dist(P);if(de>2*b){const Se=A.add(P.sub(A)._mult(b/de)._round());this.updateDistance(A,Se),this.addCurrentVertex(Se,V,0,0,T),A=Se}}}}addCurrentVertex(e,r,a,o,u,d=!1){const f=r.y*o-r.x,_=-r.y-r.x*o;this.addHalfVertex(e,r.x+r.y*a,r.y-r.x*a,d,!1,a,u),this.addHalfVertex(e,f,_,d,!0,-o,u),this.distance>ih/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,a,o,u,d))}addHalfVertex({x:e,y:r},a,o,u,d,f,_){const x=.5*(this.lineClips?this.scaledDistance*(ih-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*a)+128,Math.round(63*o)+128,1+(f===0?0:f<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=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),_.primitiveLength++),d?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(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let rh,sh;we("LineBucket",ic,{omit:["layers","patternFeatures"]});var ah={get paint(){return sh=sh||new Mt({"line-opacity":new De(re.paint_line["line-opacity"]),"line-color":new De(re.paint_line["line-color"]),"line-translate":new Ce(re.paint_line["line-translate"]),"line-translate-anchor":new Ce(re.paint_line["line-translate-anchor"]),"line-width":new De(re.paint_line["line-width"]),"line-gap-width":new De(re.paint_line["line-gap-width"]),"line-offset":new De(re.paint_line["line-offset"]),"line-blur":new De(re.paint_line["line-blur"]),"line-dasharray":new Nn(re.paint_line["line-dasharray"]),"line-pattern":new oa(re.paint_line["line-pattern"]),"line-gradient":new Un(re.paint_line["line-gradient"])})},get layout(){return rh=rh||new Mt({"line-cap":new Ce(re.layout_line["line-cap"]),"line-join":new De(re.layout_line["line-join"]),"line-miter-limit":new Ce(re.layout_line["line-miter-limit"]),"line-round-limit":new Ce(re.layout_line["line-round-limit"]),"line-sort-key":new De(re.layout_line["line-sort-key"])})}};class cp extends De{possiblyEvaluate(e,r){return r=new ht(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,a,o){return r=$t({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,a,o)}}let ol;class hp extends Vi{constructor(e){super(e,ah),this.gradientVersion=0,ol||(ol=new cp(ah.paint.properties["line-width"].specification),ol.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Lr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=ol.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ic(e)}queryRadius(e){const r=e,a=nh(Hn("line-width",this,r),Hn("line-gap-width",this,r)),o=Hn("line-offset",this,r);return a/2+Math.abs(o)+el(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f){const _=tl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*nh(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),b=this.paint.get("line-offset").evaluate(r,a);return b&&(o=function(T,A){const C=[];for(let P=0;P<T.length;P++){const D=T[P],V=[];for(let $=0;$<D.length;$++){const H=D[$-1],q=D[$],Y=D[$+1],Q=$===0?new Be(0,0):q.sub(H)._unit()._perp(),oe=$===D.length-1?new Be(0,0):Y.sub(q)._unit()._perp(),be=Q._add(oe)._unit(),Ae=be.x*oe.x+be.y*oe.y;Ae!==0&&be._mult(1/Ae),V.push(be._mult(A)._add(q))}C.push(V)}return C}(o,b*f)),function(T,A,C){for(let P=0;P<A.length;P++){const D=A[P];if(T.length>=3){for(let V=0;V<D.length;V++)if(Wa(T,D[V]))return!0}if(gu(T,D,C))return!0}return!1}(_,o,x)}isTileClipped(){return!0}}function nh(i,e){return e>0?e+2*i:i}const up=xt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pp=xt([{name:"a_projected_pos",components:3,type:"Float32"}],4);xt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const dp=xt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);xt([{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 oh=xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),fp=xt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function mp(i,e,r){return i.sections.forEach(a=>{a.text=function(o,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),Ii.applyArabicShaping&&(o=Ii.applyArabicShaping(o)),o}(a.text,e,r)}),i}xt([{name:"triangle",components:3,type:"Uint16"}]),xt([{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"}]),xt([{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"}]),xt([{type:"Float32",name:"offsetX"}]),xt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),xt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const so={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rt=24,lh=at,ch=function(i,e,r,a,o){var u,d,f=8*o-a-1,_=(1<<f)-1,x=_>>1,b=-7,T=r?o-1:0,A=r?-1:1,C=i[e+T];for(T+=A,u=C&(1<<-b)-1,C>>=-b,b+=f;b>0;u=256*u+i[e+T],T+=A,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=a;b>0;d=256*d+i[e+T],T+=A,b-=8);if(u===0)u=1-x;else{if(u===_)return d?NaN:1/0*(C?-1:1);d+=Math.pow(2,a),u-=x}return(C?-1:1)*d*Math.pow(2,u-a)},hh=function(i,e,r,a,o,u){var d,f,_,x=8*u-o-1,b=(1<<x)-1,T=b>>1,A=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=a?0:u-1,P=a?1:-1,D=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=b):(d=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-d))<1&&(d--,_*=2),(e+=d+T>=1?A/_:A*Math.pow(2,1-T))*_>=2&&(d++,_/=2),d+T>=b?(f=0,d=b):d+T>=1?(f=(e*_-1)*Math.pow(2,o),d+=T):(f=e*Math.pow(2,T-1)*Math.pow(2,o),d=0));o>=8;i[r+C]=255&f,C+=P,f/=256,o-=8);for(d=d<<o|f,x+=o;x>0;i[r+C]=255&d,C+=P,d/=256,x-=8);i[r+C-P]|=128*D};function at(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}at.Varint=0,at.Fixed64=1,at.Bytes=2,at.Fixed32=5;var rc=4294967296,uh=1/rc,ph=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function os(i){return i.type===at.Bytes?i.readVarint()+i.pos:i.pos+1}function Ja(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function dh(i,e,r){var a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(a);for(var o=r.pos-1;o>=i;o--)r.buf[o+a]=r.buf[o]}function gp(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function _p(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function yp(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function xp(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function vp(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function bp(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function wp(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Sp(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Tp(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function ll(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Qa(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function fh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}at.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),o=a>>3,u=this.pos;this.type=7&a,i(o,e,this),this.pos===u&&this.skip(a)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=ll(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=fh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ll(this.buf,this.pos)+ll(this.buf,this.pos+4)*rc;return this.pos+=8,i},readSFixed64:function(){var i=ll(this.buf,this.pos)+fh(this.buf,this.pos+4)*rc;return this.pos+=8,i},readFloat:function(){var i=ch(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=ch(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,a=this.buf;return e=127&(r=a[this.pos++]),r<128?e:(e|=(127&(r=a[this.pos++]))<<7,r<128?e:(e|=(127&(r=a[this.pos++]))<<14,r<128?e:(e|=(127&(r=a[this.pos++]))<<21,r<128?e:function(o,u,d){var f,_,x=d.buf;if(f=(112&(_=x[d.pos++]))>>4,_<128||(f|=(127&(_=x[d.pos++]))<<3,_<128)||(f|=(127&(_=x[d.pos++]))<<10,_<128)||(f|=(127&(_=x[d.pos++]))<<17,_<128)||(f|=(127&(_=x[d.pos++]))<<24,_<128)||(f|=(1&(_=x[d.pos++]))<<31,_<128))return Ja(o,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&ph?function(r,a,o){return ph.decode(r.subarray(a,o))}(this.buf,e,i):function(r,a,o){for(var u="",d=a;d<o;){var f,_,x,b=r[d],T=null,A=b>239?4:b>223?3:b>191?2:1;if(d+A>o)break;A===1?b<128&&(T=b):A===2?(192&(f=r[d+1]))==128&&(T=(31&b)<<6|63&f)<=127&&(T=null):A===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((T=(15&b)<<12|(63&f)<<6|63&_)<=2047||T>=55296&&T<=57343)&&(T=null)):A===4&&(_=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&x)==128&&((T=(15&b)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||T>=1114112)&&(T=null)),T===null?(T=65533,A=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==at.Bytes)return i.push(this.readVarint(e));var r=os(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==at.Bytes)return i.push(this.readSVarint());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==at.Bytes)return i.push(this.readBoolean());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==at.Bytes)return i.push(this.readFloat());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==at.Bytes)return i.push(this.readDouble());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==at.Bytes)return i.push(this.readFixed32());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==at.Bytes)return i.push(this.readSFixed32());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==at.Bytes)return i.push(this.readFixed64());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==at.Bytes)return i.push(this.readSFixed64());var e=os(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===at.Varint)for(;this.buf[this.pos++]>127;);else if(e===at.Bytes)this.pos=this.readVarint()+this.pos;else if(e===at.Fixed32)this.pos+=4;else{if(e!==at.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Qa(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Qa(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Qa(this.buf,-1&i,this.pos),Qa(this.buf,Math.floor(i*uh),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Qa(this.buf,-1&i,this.pos),Qa(this.buf,Math.floor(i*uh),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var a,o;if(e>=0?(a=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(a=~(-e%4294967296))?a=a+1|0:(a=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(a,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(a,o,u){for(var d,f,_=0;_<o.length;_++){if((d=o.charCodeAt(_))>55295&&d<57344){if(!f){d>56319||_+1===o.length?(a[u++]=239,a[u++]=191,a[u++]=189):f=d;continue}if(d<56320){a[u++]=239,a[u++]=191,a[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[u++]=239,a[u++]=191,a[u++]=189,f=null);d<128?a[u++]=d:(d<2048?a[u++]=d>>6|192:(d<65536?a[u++]=d>>12|224:(a[u++]=d>>18|240,a[u++]=d>>12&63|128),a[u++]=d>>6&63|128),a[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&dh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),hh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),hh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var a=this.pos-r;a>=128&&dh(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,e,r){this.writeTag(i,at.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,gp,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,_p,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,vp,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,yp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,xp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,bp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,wp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Sp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Tp,e)},writeBytesField:function(i,e){this.writeTag(i,at.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,at.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,at.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,at.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,at.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,at.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,at.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,at.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,at.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,at.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var sc=ie(lh);const ac=3;function Ip(i,e,r){i===1&&r.readMessage(Ap,e)}function Ap(i,e,r){if(i===3){const{id:a,bitmap:o,width:u,height:d,left:f,top:_,advance:x}=r.readMessage(Mp,{});e.push({id:a,bitmap:new Yn({width:u+2*ac,height:d+2*ac},o),metrics:{width:u,height:d,left:f,top:_,advance:x}})}}function Mp(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const mh=ac;function gh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let o=0,u=0;for(const d of i)for(let f=a.length-1;f>=0;f--){const _=a[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),o=Math.max(o,d.x+d.w),d.w===_.w&&d.h===_.h){const x=a.pop();f<a.length&&(a[f]=x)}else d.h===_.h?(_.x+=d.w,_.w-=d.w):d.w===_.w?(_.y+=d.h,_.h-=d.h):(a.push({x:_.x+d.w,y:_.y,w:_.w-d.w,h:d.h}),_.y+=d.h,_.h-=d.h);break}}return{w:o,h:u,fill:e/(o*u)||0}}const Mi=1;class nc{constructor(e,{pixelRatio:r,version:a,stretchX:o,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=o,this.stretchY=u,this.content=d,this.version=a}get tl(){return[this.paddedRect.x+Mi,this.paddedRect.y+Mi]}get br(){return[this.paddedRect.x+this.paddedRect.w-Mi,this.paddedRect.y+this.paddedRect.h-Mi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Mi)/this.pixelRatio,(this.paddedRect.h-2*Mi)/this.pixelRatio]}}class _h{constructor(e,r){const a={},o={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,u),this.addImages(r,o,u);const{w:d,h:f}=gh(u),_=new qi({width:d||1,height:f||1});for(const x in e){const b=e[x],T=a[x].paddedRect;qi.copy(b.data,_,{x:0,y:0},{x:T.x+Mi,y:T.y+Mi},b.data)}for(const x in r){const b=r[x],T=o[x].paddedRect,A=T.x+Mi,C=T.y+Mi,P=b.data.width,D=b.data.height;qi.copy(b.data,_,{x:0,y:0},{x:A,y:C},b.data),qi.copy(b.data,_,{x:0,y:D-1},{x:A,y:C-1},{width:P,height:1}),qi.copy(b.data,_,{x:0,y:0},{x:A,y:C+D},{width:P,height:1}),qi.copy(b.data,_,{x:P-1,y:0},{x:A-1,y:C},{width:1,height:D}),qi.copy(b.data,_,{x:0,y:0},{x:A+P,y:C},{width:1,height:D})}this.image=_,this.iconPositions=a,this.patternPositions=o}addImages(e,r,a){for(const o in e){const u=e[o],d={x:0,y:0,w:u.data.width+2*Mi,h:u.data.height+2*Mi};a.push(d),r[o]=new nc(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),r)}patchUpdatedImage(e,r,a){if(!e||!r||e.version===r.version)return;e.version=r.version;const[o,u]=e.tl;a.update(r.data,void 0,{x:o,y:u})}}var Bs;we("ImagePosition",nc),we("ImageAtlas",_h),c.ai=void 0,(Bs=c.ai||(c.ai={}))[Bs.none=0]="none",Bs[Bs.horizontal=1]="horizontal",Bs[Bs.vertical=2]="vertical",Bs[Bs.horizontalOnly=3]="horizontalOnly";const ao=-17;class no{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const a=new no;return a.scale=e||1,a.fontStack=r,a}static forImage(e){const r=new no;return r.imageName=e,r}}class en{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const a=new en;for(let o=0;o<e.sections.length;o++){const u=e.sections[o];u.image?a.addImageSection(u):a.addTextSection(u,r)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let a=0;a<e.length;a++){const o=e.charCodeAt(a+1)||null,u=e.charCodeAt(a-1)||null;r+=o&&jo(o)&&!so[e[a+1]]||u&&jo(u)&&!so[e[a-1]]||!so[e[a]]?e[a]:so[e[a]]}return r}(this.text)}trim(){let e=0;for(let a=0;a<this.text.length&&hl[this.text.charCodeAt(a)];a++)e++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=e&&hl[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const a=new en;return a.text=this.text.substring(e,r),a.sectionIndex=this.sectionIndex.slice(e,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(no.forText(e.scale,e.fontStack||r));const a=this.sections.length-1;for(let o=0;o<e.text.length;++o)this.sectionIndex.push(a)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ti("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(no.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ti("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cl(i,e,r,a,o,u,d,f,_,x,b,T,A,C,P,D){const V=en.fromFeature(i,o);let $;T===c.ai.vertical&&V.verticalizePunctuation();const{processBidirectionalText:H,processStyledBidirectionalText:q}=Ii;if(H&&V.sections.length===1){$=[];const oe=H(V.toString(),oc(V,x,u,e,a,C,P));for(const be of oe){const Ae=new en;Ae.text=be,Ae.sections=V.sections;for(let xe=0;xe<be.length;xe++)Ae.sectionIndex.push(0);$.push(Ae)}}else if(q){$=[];const oe=q(V.text,V.sectionIndex,oc(V,x,u,e,a,C,P));for(const be of oe){const Ae=new en;Ae.text=be[0],Ae.sectionIndex=be[1],Ae.sections=V.sections,$.push(Ae)}}else $=function(oe,be){const Ae=[],xe=oe.text;let ye=0;for(const de of be)Ae.push(oe.substring(ye,de)),ye=de;return ye<xe.length&&Ae.push(oe.substring(ye,xe.length)),Ae}(V,oc(V,x,u,e,a,C,P));const Y=[],Q={positionedLines:Y,text:V.toString(),top:b[1],bottom:b[1],left:b[0],right:b[0],writingMode:T,iconsInText:!1,verticalizable:!1};return function(oe,be,Ae,xe,ye,de,Se,me,ue,ke,Ee,$e){let pt=0,ft=ao,Ft=0,Ui=0;const gi=me==="right"?1:me==="left"?0:.5;let Dt=0;for(const Ot of ye){Ot.trim();const Vt=Ot.getMaxScale(),ai=(Vt-1)*Rt,xi={positionedGlyphs:[],lineOffset:0};oe.positionedLines[Dt]=xi;const ni=xi.positionedGlyphs;let Ei=0;if(!Ot.length()){ft+=de,++Dt;continue}for(let Nt=0;Nt<Ot.length();Nt++){const Ge=Ot.getSection(Nt),oi=Ot.getSectionIndex(Nt),Qt=Ot.getCharCode(Nt);let Ut=0,or=null,br=null,wr=null,ls=Rt;const lr=!(ue===c.ai.horizontal||!Ee&&!zn(Qt)||Ee&&(hl[Qt]||(Xt=Qt,ve.Arabic(Xt)||ve["Arabic Supplement"](Xt)||ve["Arabic Extended-A"](Xt)||ve["Arabic Presentation Forms-A"](Xt)||ve["Arabic Presentation Forms-B"](Xt))));if(Ge.imageName){const Gi=xe[Ge.imageName];if(!Gi)continue;wr=Ge.imageName,oe.iconsInText=oe.iconsInText||!0,br=Gi.paddedRect;const Pi=Gi.displaySize;Ge.scale=Ge.scale*Rt/$e,or={width:Pi[0],height:Pi[1],left:Mi,top:-mh,advance:lr?Pi[1]:Pi[0]},Ut=ai+(Rt-Pi[1]*Ge.scale),ls=or.advance;const cs=lr?Pi[0]*Ge.scale-Rt*Vt:Pi[1]*Ge.scale-Rt*Vt;cs>0&&cs>Ei&&(Ei=cs)}else{const Gi=Ae[Ge.fontStack],Pi=Gi&&Gi[Qt];if(Pi&&Pi.rect)br=Pi.rect,or=Pi.metrics;else{const cs=be[Ge.fontStack],uo=cs&&cs[Qt];if(!uo)continue;or=uo.metrics}Ut=(Vt-Ge.scale)*Rt}lr?(oe.verticalizable=!0,ni.push({glyph:Qt,imageName:wr,x:pt,y:ft+Ut,vertical:lr,scale:Ge.scale,fontStack:Ge.fontStack,sectionIndex:oi,metrics:or,rect:br}),pt+=ls*Ge.scale+ke):(ni.push({glyph:Qt,imageName:wr,x:pt,y:ft+Ut,vertical:lr,scale:Ge.scale,fontStack:Ge.fontStack,sectionIndex:oi,metrics:or,rect:br}),pt+=or.advance*Ge.scale+ke)}ni.length!==0&&(Ft=Math.max(pt-ke,Ft),Pp(ni,0,ni.length-1,gi,Ei)),pt=0;const Ci=de*Vt+Ei;xi.lineOffset=Math.max(Ei,ai),ft+=Ci,Ui=Math.max(Ci,Ui),++Dt}var Xt;const Jt=ft-ao,{horizontalAlign:_i,verticalAlign:yi}=lc(Se);(function(Ot,Vt,ai,xi,ni,Ei,Ci,Nt,Ge){const oi=(Vt-ai)*ni;let Qt=0;Qt=Ei!==Ci?-Nt*xi-ao:(-xi*Ge+.5)*Ci;for(const Ut of Ot)for(const or of Ut.positionedGlyphs)or.x+=oi,or.y+=Qt})(oe.positionedLines,gi,_i,yi,Ft,Ui,de,Jt,ye.length),oe.top+=-yi*Jt,oe.bottom=oe.top+Jt,oe.left+=-_i*Ft,oe.right=oe.left+Ft}(Q,e,r,a,$,d,f,_,T,x,A,D),!function(oe){for(const be of oe)if(be.positionedGlyphs.length!==0)return!1;return!0}(Y)&&Q}const hl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ep={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function yh(i,e,r,a,o,u){if(e.imageName){const d=a[e.imageName];return d?d.displaySize[0]*e.scale*Rt/u+o:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+o:0}}function xh(i,e,r,a){const o=Math.pow(i-e,2);return a?i<e?o/2:2*o:o+Math.abs(r)*r}function Cp(i,e,r){let a=0;return i===10&&(a-=1e4),r&&(a+=150),i!==40&&i!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function vh(i,e,r,a,o,u){let d=null,f=xh(e,r,o,u);for(const _ of a){const x=xh(e-_.x,r,o,u)+_.badness;x<=f&&(d=_,f=x)}return{index:i,x:e,priorBreak:d,badness:f}}function bh(i){return i?bh(i.priorBreak).concat(i.index):[]}function oc(i,e,r,a,o,u,d){if(u!=="point")return[];if(!i)return[];const f=[],_=function(A,C,P,D,V,$){let H=0;for(let q=0;q<A.length();q++){const Y=A.getSection(q);H+=yh(A.getCharCode(q),Y,D,V,C,$)}return H/Math.max(1,Math.ceil(H/P))}(i,e,r,a,o,d),x=i.text.indexOf("")>=0;let b=0;for(let A=0;A<i.length();A++){const C=i.getSection(A),P=i.getCharCode(A);if(hl[P]||(b+=yh(P,C,a,o,e,d)),A<i.length()-1){const D=!((T=P)<11904||!(ve["Bopomofo Extended"](T)||ve.Bopomofo(T)||ve["CJK Compatibility Forms"](T)||ve["CJK Compatibility Ideographs"](T)||ve["CJK Compatibility"](T)||ve["CJK Radicals Supplement"](T)||ve["CJK Strokes"](T)||ve["CJK Symbols and Punctuation"](T)||ve["CJK Unified Ideographs Extension A"](T)||ve["CJK Unified Ideographs"](T)||ve["Enclosed CJK Letters and Months"](T)||ve["Halfwidth and Fullwidth Forms"](T)||ve.Hiragana(T)||ve["Ideographic Description Characters"](T)||ve["Kangxi Radicals"](T)||ve["Katakana Phonetic Extensions"](T)||ve.Katakana(T)||ve["Vertical Forms"](T)||ve["Yi Radicals"](T)||ve["Yi Syllables"](T)));(Ep[P]||D||C.imageName)&&f.push(vh(A+1,b,_,f,Cp(P,i.getCharCode(A+1),D&&x),!1))}}var T;return bh(vh(i.length(),b,_,f,0,!0))}function lc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Pp(i,e,r,a,o){if(!a&&!o)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*a;for(let f=e;f<=r;f++)i[f].x-=d,i[f].y+=o}function kp(i,e,r){const{horizontalAlign:a,verticalAlign:o}=lc(r),u=e[0]-i.displaySize[0]*a,d=e[1]-i.displaySize[1]*o;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function wh(i,e,r,a,o,u){const d=i.image;let f;if(d.content){const V=d.content,$=d.pixelRatio||1;f=[V[0]/$,V[1]/$,d.displaySize[0]-V[2]/$,d.displaySize[1]-V[3]/$]}const _=e.left*u,x=e.right*u;let b,T,A,C;r==="width"||r==="both"?(C=o[0]+_-a[3],T=o[0]+x+a[1]):(C=o[0]+(_+x-d.displaySize[0])/2,T=C+d.displaySize[0]);const P=e.top*u,D=e.bottom*u;return r==="height"||r==="both"?(b=o[1]+P-a[0],A=o[1]+D+a[2]):(b=o[1]+(P+D-d.displaySize[1])/2,A=b+d.displaySize[1]),{image:d,top:b,right:T,bottom:A,left:C,collisionPadding:f}}const oo=255,Vr=128,Rs=oo*Vr;function Sh(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ht(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:o}=r;let u=0;for(;u<a.length&&a[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<a.length&&a[d]<i+1;)d++;d=Math.min(a.length-1,d);const f=a[u],_=a[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:_,interpolationType:o}:{kind:"camera",minZoom:f,maxZoom:_,minSize:r.evaluate(new ht(f)),maxSize:r.evaluate(new ht(_)),interpolationType:o}}}function cc(i,e,r){let a="never";const o=i.get(e);return o?a=o:i.get(r)&&(a="always"),a}const zp=Ls.VectorTileFeature.types,Dp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ul(i,e,r,a,o,u,d,f,_,x,b,T,A){const C=f?Math.min(Rs,Math.round(f[0])):0,P=f?Math.min(Rs,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*a),Math.round(32*o),u,d,(C<<1)+(_?1:0),P,16*x,16*b,256*T,256*A)}function hc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function Lp(i){for(const e of i.sections)if(Rl(e.text))return!0;return!1}class uc{constructor(e){this.layoutVertexArray=new je,this.indexArray=new Zt,this.programConfigurations=e,this.segments=new ut,this.dynamicLayoutVertexArray=new Ne,this.opacityVertexArray=new Ze,this.hasVisibleVertices=!1,this.placedSymbolArray=new G}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,a,o){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,up.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Dp,!0),this.opacityVertexBuffer.itemSize=1),(a||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}we("SymbolBuffers",uc);class pc{constructor(e,r,a){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new a,this.segments=new ut,this.collisionVertexArray=new lt}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,dp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}we("CollisionBuffers",pc);class tn{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=jl([]),this.placementViewportMatrix=jl([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Sh(this.zoom,r["text-size"]),this.iconSizeData=Sh(this.zoom,r["icon-size"]);const a=this.layers[0].layout,o=a.get("symbol-sort-key"),u=a.get("symbol-z-order");this.canOverlap=cc(a,"text-overlap","text-allow-overlap")!=="never"||cc(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(d=>c.ai[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new uc(new vr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new uc(new vr(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new X,this.lineVertexArray=new ee,this.symbolInstances=new U,this.textAnchorOffsets=new ne}calculateGlyphDependencies(e,r,a,o,u){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(a||o)&&u){const f=so[e.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,a){const o=this.layers[0],u=o.layout,d=u.get("text-font"),f=u.get("text-field"),_=u.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof Ht&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),b=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!x&&!b)return;const A=r.iconDependencies,C=r.glyphDependencies,P=r.availableImages,D=new ht(this.zoom);for(const{feature:V,id:$,index:H,sourceLayerIndex:q}of e){const Y=o._featureFilter.needGeometry,Q=ua(V,Y);if(!o._featureFilter.filter(D,Q,a))continue;let oe,be;if(Y||(Q.geometry=ha(V)),x){const xe=o.getValueAndResolveTokens("text-field",Q,a,P),ye=Ht.factory(xe);Lp(ye)&&(this.hasRTLText=!0),(!this.hasRTLText||On()==="unavailable"||this.hasRTLText&&Ii.isParsed())&&(oe=mp(ye,o,Q))}if(b){const xe=o.getValueAndResolveTokens("icon-image",Q,a,P);be=xe instanceof qt?xe:qt.fromString(xe)}if(!oe&&!be)continue;const Ae=this.sortFeaturesByKey?T.evaluate(Q,{},a):void 0;if(this.features.push({id:$,text:oe,icon:be,index:H,sourceLayerIndex:q,geometry:Q.geometry,properties:V.properties,type:zp[V.type],sortKey:Ae}),be&&(A[be.name]=!0),oe){const xe=d.evaluate(Q,{},a).join(","),ye=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ai.vertical)>=0;for(const de of oe.sections)if(de.image)A[de.image.name]=!0;else{const Se=Pn(oe.toString()),me=de.fontStack||xe,ue=C[me]=C[me]||{};this.calculateGlyphDependencies(de.text,ue,ye,this.allowVerticalPlacement,Se)}}}u.get("symbol-placement")==="line"&&(this.features=function(V){const $={},H={},q=[];let Y=0;function Q(xe){q.push(V[xe]),Y++}function oe(xe,ye,de){const Se=H[xe];return delete H[xe],H[ye]=Se,q[Se].geometry[0].pop(),q[Se].geometry[0]=q[Se].geometry[0].concat(de[0]),Se}function be(xe,ye,de){const Se=$[ye];return delete $[ye],$[xe]=Se,q[Se].geometry[0].shift(),q[Se].geometry[0]=de[0].concat(q[Se].geometry[0]),Se}function Ae(xe,ye,de){const Se=de?ye[0][ye[0].length-1]:ye[0][0];return`${xe}:${Se.x}:${Se.y}`}for(let xe=0;xe<V.length;xe++){const ye=V[xe],de=ye.geometry,Se=ye.text?ye.text.toString():null;if(!Se){Q(xe);continue}const me=Ae(Se,de),ue=Ae(Se,de,!0);if(me in H&&ue in $&&H[me]!==$[ue]){const ke=be(me,ue,de),Ee=oe(me,ue,q[ke].geometry);delete $[me],delete H[ue],H[Ae(Se,q[Ee].geometry,!0)]=Ee,q[ke].geometry=null}else me in H?oe(me,ue,de):ue in $?be(me,ue,de):(Q(xe),$[me]=Y-1,H[ue]=Y-1)}return q.filter(xe=>xe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,$)=>V.sortKey-$.sortKey)}update(e,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const a=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:o},f<r.length-1&&(o+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const _=d[f];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,r,a,o,u,d,f,_,x,b,T,A){const C=e.indexArray,P=e.layoutVertexArray,D=e.segments.prepareSegment(4*r.length,P,C,this.canOverlap?d.sortKey:void 0),V=this.glyphOffsetArray.length,$=D.vertexLength,H=this.allowVerticalPlacement&&f===c.ai.vertical?Math.PI/2:0,q=d.text&&d.text.sections;for(let Y=0;Y<r.length;Y++){const{tl:Q,tr:oe,bl:be,br:Ae,tex:xe,pixelOffsetTL:ye,pixelOffsetBR:de,minFontScaleX:Se,minFontScaleY:me,glyphOffset:ue,isSDF:ke,sectionIndex:Ee}=r[Y],$e=D.vertexLength,pt=ue[1];ul(P,_.x,_.y,Q.x,pt+Q.y,xe.x,xe.y,a,ke,ye.x,ye.y,Se,me),ul(P,_.x,_.y,oe.x,pt+oe.y,xe.x+xe.w,xe.y,a,ke,de.x,ye.y,Se,me),ul(P,_.x,_.y,be.x,pt+be.y,xe.x,xe.y+xe.h,a,ke,ye.x,de.y,Se,me),ul(P,_.x,_.y,Ae.x,pt+Ae.y,xe.x+xe.w,xe.y+xe.h,a,ke,de.x,de.y,Se,me),hc(e.dynamicLayoutVertexArray,_,H),C.emplaceBack($e,$e+1,$e+2),C.emplaceBack($e+1,$e+2,$e+3),D.vertexLength+=4,D.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ue[0]),Y!==r.length-1&&Ee===r[Y+1].sectionIndex||e.programConfigurations.populatePaintArrays(P.length,d,d.index,{},A,q&&q[Ee])}e.placedSymbolArray.emplaceBack(_.x,_.y,V,this.glyphOffsetArray.length-V,$,x,b,_.segment,a?a[0]:0,a?a[1]:0,o[0],o[1],f,0,!1,0,T)}_addCollisionDebugVertex(e,r,a,o,u,d){return r.emplaceBack(0,0),e.emplaceBack(a.x,a.y,o,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,a,o,u,d,f){const _=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),x=_.vertexLength,b=u.layoutVertexArray,T=u.collisionVertexArray,A=f.anchorX,C=f.anchorY;this._addCollisionDebugVertex(b,T,d,A,C,new Be(e,r)),this._addCollisionDebugVertex(b,T,d,A,C,new Be(a,r)),this._addCollisionDebugVertex(b,T,d,A,C,new Be(a,o)),this._addCollisionDebugVertex(b,T,d,A,C,new Be(e,o)),_.vertexLength+=4;const P=u.indexArray;P.emplaceBack(x,x+1),P.emplaceBack(x+1,x+2),P.emplaceBack(x+2,x+3),P.emplaceBack(x+3,x),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,a,o){for(let u=e;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,o?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new pc(Tt,oh.members,Lt),this.iconCollisionBox=new pc(Tt,oh.members,Lt);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);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(e,r,a,o,u,d,f,_,x){const b={};for(let T=r;T<a;T++){const A=e.get(T);b.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},b.textFeatureIndex=A.featureIndex;break}for(let T=o;T<u;T++){const A=e.get(T);b.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},b.verticalTextFeatureIndex=A.featureIndex;break}for(let T=d;T<f;T++){const A=e.get(T);b.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},b.iconFeatureIndex=A.featureIndex;break}for(let T=_;T<x;T++){const A=e.get(T);b.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},b.verticalIconFeatureIndex=A.featureIndex;break}return b}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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(e,r){const a=e.placedSymbolArray.get(r),o=a.vertexStartIndex+4*a.numGlyphs;for(let u=a.vertexStartIndex;u<o;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),a=Math.cos(e),o=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const _=this.symbolInstances.get(f);o.push(0|Math.round(r*_.anchorX+a*_.anchorY)),u.push(_.featureIndex)}return d.sort((f,_)=>o[f]-o[_]||u[_]-u[f]),d}addToSortKeyRanges(e,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((o,u,d)=>{o>=0&&d.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Th,Ih;we("SymbolBucket",tn,{omit:["layers","collisionBoxArray","features","compareText"]}),tn.MAX_GLYPHS=65535,tn.addDynamicAttributes=hc;var dc={get paint(){return Ih=Ih||new Mt({"icon-opacity":new De(re.paint_symbol["icon-opacity"]),"icon-color":new De(re.paint_symbol["icon-color"]),"icon-halo-color":new De(re.paint_symbol["icon-halo-color"]),"icon-halo-width":new De(re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new De(re.paint_symbol["icon-halo-blur"]),"icon-translate":new Ce(re.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ce(re.paint_symbol["icon-translate-anchor"]),"text-opacity":new De(re.paint_symbol["text-opacity"]),"text-color":new De(re.paint_symbol["text-color"],{runtimeType:ii,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new De(re.paint_symbol["text-halo-color"]),"text-halo-width":new De(re.paint_symbol["text-halo-width"]),"text-halo-blur":new De(re.paint_symbol["text-halo-blur"]),"text-translate":new Ce(re.paint_symbol["text-translate"]),"text-translate-anchor":new Ce(re.paint_symbol["text-translate-anchor"])})},get layout(){return Th=Th||new Mt({"symbol-placement":new Ce(re.layout_symbol["symbol-placement"]),"symbol-spacing":new Ce(re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ce(re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new De(re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ce(re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ce(re.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ce(re.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ce(re.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ce(re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ce(re.layout_symbol["icon-rotation-alignment"]),"icon-size":new De(re.layout_symbol["icon-size"]),"icon-text-fit":new Ce(re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ce(re.layout_symbol["icon-text-fit-padding"]),"icon-image":new De(re.layout_symbol["icon-image"]),"icon-rotate":new De(re.layout_symbol["icon-rotate"]),"icon-padding":new De(re.layout_symbol["icon-padding"]),"icon-keep-upright":new Ce(re.layout_symbol["icon-keep-upright"]),"icon-offset":new De(re.layout_symbol["icon-offset"]),"icon-anchor":new De(re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ce(re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ce(re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ce(re.layout_symbol["text-rotation-alignment"]),"text-field":new De(re.layout_symbol["text-field"]),"text-font":new De(re.layout_symbol["text-font"]),"text-size":new De(re.layout_symbol["text-size"]),"text-max-width":new De(re.layout_symbol["text-max-width"]),"text-line-height":new Ce(re.layout_symbol["text-line-height"]),"text-letter-spacing":new De(re.layout_symbol["text-letter-spacing"]),"text-justify":new De(re.layout_symbol["text-justify"]),"text-radial-offset":new De(re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ce(re.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new De(re.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new De(re.layout_symbol["text-anchor"]),"text-max-angle":new Ce(re.layout_symbol["text-max-angle"]),"text-writing-mode":new Ce(re.layout_symbol["text-writing-mode"]),"text-rotate":new De(re.layout_symbol["text-rotate"]),"text-padding":new Ce(re.layout_symbol["text-padding"]),"text-keep-upright":new Ce(re.layout_symbol["text-keep-upright"]),"text-transform":new De(re.layout_symbol["text-transform"]),"text-offset":new De(re.layout_symbol["text-offset"]),"text-allow-overlap":new Ce(re.layout_symbol["text-allow-overlap"]),"text-overlap":new Ce(re.layout_symbol["text-overlap"]),"text-ignore-placement":new Ce(re.layout_symbol["text-ignore-placement"]),"text-optional":new Ce(re.layout_symbol["text-optional"])})}};class Ah{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:dr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}we("FormatSectionOverride",Ah,{omit:["defaultValue"]});class pl extends Vi{constructor(e){super(e,dc)}recalculate(e,r){if(super.recalculate(e,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 a=this.layout.get("text-writing-mode");if(a){const o=[];for(const u of a)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,a,o){const u=this.layout.get(e).evaluate(r,{},a,o),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ba(d.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,b)=>f&&b in f?String(f[b]):"")}(r.properties,u)}createBucket(e){return new tn(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of dc.paint.overridableProperties){if(!pl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),a=new Ah(r),o=new Tn(a,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new In("source",o):new Fa("composite",o,r.value.zoomStops),this.paint._values[e]=new ri(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&pl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const a=e.get("text-field"),o=dc.paint.properties[r];let u=!1;const d=f=>{for(const _ of f)if(o.overrides&&o.overrides.hasOverride(_))return void(u=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Ht)d(a.value.value.sections);else if(a.value.kind==="source"){const f=x=>{u||(x instanceof Hr&>(x.value)===R?d(x.value.sections):x instanceof La?d(x.sections):x.eachChild(f))},_=a.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Mh;var Bp={get paint(){return Mh=Mh||new Mt({"background-color":new Ce(re.paint_background["background-color"]),"background-pattern":new Nn(re.paint_background["background-pattern"]),"background-opacity":new Ce(re.paint_background["background-opacity"])})}};class Rp extends Vi{constructor(e){super(e,Bp)}}let Eh;var Fp={get paint(){return Eh=Eh||new Mt({"raster-opacity":new Ce(re.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ce(re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ce(re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ce(re.paint_raster["raster-brightness-max"]),"raster-saturation":new Ce(re.paint_raster["raster-saturation"]),"raster-contrast":new Ce(re.paint_raster["raster-contrast"]),"raster-resampling":new Ce(re.paint_raster["raster-resampling"]),"raster-fade-duration":new Ce(re.paint_raster["raster-fade-duration"])})}};class Op extends Vi{constructor(e){super(e,Fp)}}class Vp extends Vi{constructor(e){super(e,{}),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=e}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 Np{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const fc=63710088e-1;class Fs{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,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 Fs(js(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,a=this.lat*r,o=e.lat*r,u=Math.sin(a)*Math.sin(o)+Math.cos(a)*Math.cos(o)*Math.cos((e.lng-this.lng)*r);return fc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Fs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Fs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Fs(Number("lng"in e?e.lng:e.lon),Number(e.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 Ch=2*Math.PI*fc;function Ph(i){return Ch*Math.cos(i*Math.PI/180)}function kh(i){return(180+i)/360}function zh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Dh(i,e){return i/Ph(e)}function Lh(i){return 360*i-180}function mc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class dl{constructor(e,r,a=0){this.x=+e,this.y=+r,this.z=+a}static fromLngLat(e,r=0){const a=Fs.convert(e);return new dl(kh(a.lng),zh(a.lat),Dh(r,a.lat))}toLngLat(){return new Fs(Lh(this.x),mc(this.y))}toAltitude(){return this.z*Ph(mc(this.y))}meterInMercatorCoordinateUnits(){return 1/Ch*(e=mc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Bh(i,e,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class gc{constructor(e,r,a){if(e<0||e>25||a<0||a>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=a,this.key=lo(0,e,e,r,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,a){const o=(d=this.y,f=this.z,_=Bh(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=Bh(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,d,f,_,x;const b=function(T,A,C){let P,D="";for(let V=T;V>0;V--)P=1<<V-1,D+=(A&P?1:0)+(C&P?2:0);return D}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(a==="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,o)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new Be((e.x*r-this.x)*zt,(e.y*r-this.y)*zt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Rh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=lo(e,r.z,r.z,r.x,r.y)}}class Zi{constructor(e,r,a,o,u){if(e<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=r,this.canonical=new gc(a,+o,+u),this.key=lo(r,e,a,o,u)}clone(){return new Zi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Zi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zi(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?lo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):lo(this.wrap*+r,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Zi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,o=2*this.canonical.y;return[new Zi(r,this.wrap,r,a,o),new Zi(r,this.wrap,r,a+1,o),new Zi(r,this.wrap,r,a,o+1),new Zi(r,this.wrap,r,a+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Zi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Zi(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new dl(e.x-this.wrap,e.y))}}function lo(i,e,r,a,o){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*o+a).toString(36)+r.toString(36)+e.toString(36)}we("CanonicalTileID",gc),we("OverscaledTileID",Zi,{omit:["posMatrix"]});class Fh{constructor(e,r,a,o=1,u=1,d=1,f=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void ti(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=u,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let b=0;b<_;b++){const T=this.get(x,b);T>this.max&&(this.max=T),T<this.min&&(this.min=T)}}get(e,r){const a=new Uint8Array(this.data.buffer),o=4*this._idx(e,r);return this.unpack(a[o],a[o+1],a[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=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+(e+1)}unpack(e,r,a){return e*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new qi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=r*this.dim,u=r*this.dim+this.dim,d=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:o=u-1;break;case 1:u=o+1}switch(a){case-1:d=f-1;break;case 1:f=d+1}const _=-r*this.dim,x=-a*this.dim;for(let b=d;b<f;b++)for(let T=o;T<u;T++)this.data[this._idx(T,b)]=e.data[this._idx(T+_,b+x)]}}we("DEMData",Fh);class Oh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const a=e[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Vh{constructor(e,r,a,o,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=a,e._y=o,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Nh{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Cs(zt,16,0),this.grid3D=new Cs(zt,16,0),this.featureIndexArray=new ce,this.promoteId=r}insert(e,r,a,o,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,o,u);const _=d?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 A=0;A<b.length;A++){const C=b[A];T[0]=Math.min(T[0],C.x),T[1]=Math.min(T[1],C.y),T[2]=Math.max(T[2],C.x),T[3]=Math.max(T[3],C.y)}T[0]<zt&&T[1]<zt&&T[2]>=0&&T[3]>=0&&_.insert(f,T[0],T[1],T[2],T[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ls.VectorTile(new sc(this.rawTileData)).layers,this.sourceLayerCoder=new Oh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,a,o){this.loadVTLayers();const u=e.params||{},d=zt/e.tileSize/e.scale,f=Mn(u.filter),_=e.queryGeometry,x=e.queryPadding*d,b=$h(_),T=this.grid.query(b.minX-x,b.minY-x,b.maxX+x,b.maxY+x),A=$h(e.cameraQueryGeometry),C=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(V,$,H,q)=>function(Y,Q,oe,be,Ae){for(const ye of Y)if(Q<=ye.x&&oe<=ye.y&&be>=ye.x&&Ae>=ye.y)return!0;const xe=[new Be(Q,oe),new Be(Q,Ae),new Be(be,Ae),new Be(be,oe)];if(Y.length>2){for(const ye of xe)if(Wa(Y,ye))return!0}for(let ye=0;ye<Y.length-1;ye++)if(yu(Y[ye],Y[ye+1],xe))return!0;return!1}(e.cameraQueryGeometry,V-x,$-x,H+x,q+x));for(const V of C)T.push(V);T.sort(Up);const P={};let D;for(let V=0;V<T.length;V++){const $=T[V];if($===D)continue;D=$;const H=this.featureIndexArray.get($);let q=null;this.loadMatchingFeature(P,H.bucketIndex,H.sourceLayerIndex,H.featureIndex,f,u.layers,u.availableImages,r,a,o,(Y,Q,oe)=>(q||(q=ha(Y)),Q.queryIntersectsFeature(_,Y,oe,q,this.z,e.transform,d,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,a,o,u,d,f,_,x,b,T){const A=this.bucketLayerIDs[r];if(d&&!function(V,$){for(let H=0;H<V.length;H++)if($.indexOf(V[H])>=0)return!0;return!1}(d,A))return;const C=this.sourceLayerCoder.decode(a),P=this.vtLayers[C].feature(o);if(u.needGeometry){const V=ua(P,!0);if(!u.filter(new ht(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!u.filter(new ht(this.tileID.overscaledZ),P))return;const D=this.getId(P,C);for(let V=0;V<A.length;V++){const $=A[V];if(d&&d.indexOf($)<0)continue;const H=_[$];if(!H)continue;let q={};D&&b&&(q=b.getState(H.sourceLayer||"_geojsonTileLayer",D));const Y=$t({},x[$]);Y.paint=Uh(Y.paint,H.paint,P,q,f),Y.layout=Uh(Y.layout,H.layout,P,q,f);const Q=!T||T(P,H,q);if(!Q)continue;const oe=new Vh(P,this.z,this.x,this.y,D);oe.layer=Y;let be=e[$];be===void 0&&(be=e[$]=[]),be.push({featureIndex:o,feature:oe,intersectionZ:Q})}}lookupSymbolFeatures(e,r,a,o,u,d,f,_){const x={};this.loadVTLayers();const b=Mn(u);for(const T of e)this.loadMatchingFeature(x,a,o,T,b,d,f,_,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const a of r)if(e===a)return!0;return!1}getId(e,r){let a=e.id;return this.promoteId&&(a=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof a=="boolean"&&(a=Number(a))),a}}function Uh(i,e,r,a,o){return mt(i,(u,d)=>{const f=e instanceof Ga?e.get(d):null;return f&&f.evaluate?f.evaluate(r,a,o):f})}function $h(i){let e=1/0,r=1/0,a=-1/0,o=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),a=Math.max(a,u.x),o=Math.max(o,u.y);return{minX:e,minY:r,maxX:a,maxY:o}}function Up(i,e){return e-i}function jh(i,e,r,a,o){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let _;for(let x=0;x<f.length-1;x++){let b=f[x],T=f[x+1];b.x<e&&T.x<e||(b.x<e?b=new Be(e,b.y+(e-b.x)/(T.x-b.x)*(T.y-b.y))._round():T.x<e&&(T=new Be(e,b.y+(e-b.x)/(T.x-b.x)*(T.y-b.y))._round()),b.y<r&&T.y<r||(b.y<r?b=new Be(b.x+(r-b.y)/(T.y-b.y)*(T.x-b.x),r)._round():T.y<r&&(T=new Be(b.x+(r-b.y)/(T.y-b.y)*(T.x-b.x),r)._round()),b.x>=a&&T.x>=a||(b.x>=a?b=new Be(a,b.y+(a-b.x)/(T.x-b.x)*(T.y-b.y))._round():T.x>=a&&(T=new Be(a,b.y+(a-b.x)/(T.x-b.x)*(T.y-b.y))._round()),b.y>=o&&T.y>=o||(b.y>=o?b=new Be(b.x+(o-b.y)/(T.y-b.y)*(T.x-b.x),o)._round():T.y>=o&&(T=new Be(b.x+(o-b.y)/(T.y-b.y)*(T.x-b.x),o)._round()),_&&b.equals(_[_.length-1])||(_=[b],u.push(_)),_.push(T)))))}}return u}we("FeatureIndex",Nh,{omit:["rawTileData","sourceLayerCoder"]});class Os extends Be{constructor(e,r,a,o){super(e,r),this.angle=a,o!==void 0&&(this.segment=o)}clone(){return new Os(this.x,this.y,this.angle,this.segment)}}function qh(i,e,r,a,o){if(e.segment===void 0||r===0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const _=[];let x=0;for(;f<r/2;){const b=i[d],T=i[d+1];if(!T)return!1;let A=i[d-1].angleTo(b)-b.angleTo(T);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:A}),x+=A;f-_[0].distance>a;)x-=_.shift().angleDelta;if(x>o)return!1;d++,f+=b.dist(T)}return!0}function Zh(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Gh(i,e,r){return i?.6*e*r:0}function Xh(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function $p(i,e,r,a,o,u){const d=Gh(r,o,u),f=Xh(r,a)*u;let _=0;const x=Zh(i)/2;for(let b=0;b<i.length-1;b++){const T=i[b],A=i[b+1],C=T.dist(A);if(_+C>x){const P=(x-_)/C,D=wi.number(T.x,A.x,P),V=wi.number(T.y,A.y,P),$=new Os(D,V,A.angleTo(T),b);return $._round(),!d||qh(i,$,f,d,e)?$:void 0}_+=C}}function jp(i,e,r,a,o,u,d,f,_){const x=Gh(a,u,d),b=Xh(a,o),T=b*d,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-T<e/4&&(e=T+e/4),Wh(i,A?e/2*f%e:(b/2+2*u)*d*f%e,e,x,r,T,A,!1,_)}function Wh(i,e,r,a,o,u,d,f,_){const x=u/2,b=Zh(i);let T=0,A=e-r,C=[];for(let P=0;P<i.length-1;P++){const D=i[P],V=i[P+1],$=D.dist(V),H=V.angleTo(D);for(;A+r<T+$;){A+=r;const q=(A-T)/$,Y=wi.number(D.x,V.x,q),Q=wi.number(D.y,V.y,q);if(Y>=0&&Y<_&&Q>=0&&Q<_&&A-x>=0&&A+x<=b){const oe=new Os(Y,Q,H,P);oe._round(),a&&!qh(i,oe,u,a,o)||C.push(oe)}}T+=$}return f||C.length||d||(C=Wh(i,T/2,r,a,o,u,d,!0,_)),C}we("Anchor",Os);const rn=Mi;function Hh(i,e,r,a){const o=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*rn,_=u.paddedRect.h-2*rn,x=i.right-i.left,b=i.bottom-i.top,T=u.stretchX||[[0,f]],A=u.stretchY||[[0,_]],C=(de,Se)=>de+Se[1]-Se[0],P=T.reduce(C,0),D=A.reduce(C,0),V=f-P,$=_-D;let H=0,q=P,Y=0,Q=D,oe=0,be=V,Ae=0,xe=$;if(u.content&&a){const de=u.content;H=fl(T,0,de[0]),Y=fl(A,0,de[1]),q=fl(T,de[0],de[2]),Q=fl(A,de[1],de[3]),oe=de[0]-H,Ae=de[1]-Y,be=de[2]-de[0]-q,xe=de[3]-de[1]-Q}const ye=(de,Se,me,ue)=>{const ke=ml(de.stretch-H,q,x,i.left),Ee=gl(de.fixed-oe,be,de.stretch,P),$e=ml(Se.stretch-Y,Q,b,i.top),pt=gl(Se.fixed-Ae,xe,Se.stretch,D),ft=ml(me.stretch-H,q,x,i.left),Ft=gl(me.fixed-oe,be,me.stretch,P),Ui=ml(ue.stretch-Y,Q,b,i.top),gi=gl(ue.fixed-Ae,xe,ue.stretch,D),Dt=new Be(ke,$e),Xt=new Be(ft,$e),Jt=new Be(ft,Ui),_i=new Be(ke,Ui),yi=new Be(Ee/d,pt/d),Ot=new Be(Ft/d,gi/d),Vt=e*Math.PI/180;if(Vt){const ni=Math.sin(Vt),Ei=Math.cos(Vt),Ci=[Ei,-ni,ni,Ei];Dt._matMult(Ci),Xt._matMult(Ci),_i._matMult(Ci),Jt._matMult(Ci)}const ai=de.stretch+de.fixed,xi=Se.stretch+Se.fixed;return{tl:Dt,tr:Xt,bl:_i,br:Jt,tex:{x:u.paddedRect.x+rn+ai,y:u.paddedRect.y+rn+xi,w:me.stretch+me.fixed-ai,h:ue.stretch+ue.fixed-xi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:yi,pixelOffsetBR:Ot,minFontScaleX:be/d/x,minFontScaleY:xe/d/b,isSDF:r}};if(a&&(u.stretchX||u.stretchY)){const de=Kh(T,V,P),Se=Kh(A,$,D);for(let me=0;me<de.length-1;me++){const ue=de[me],ke=de[me+1];for(let Ee=0;Ee<Se.length-1;Ee++)o.push(ye(ue,Se[Ee],ke,Se[Ee+1]))}}else o.push(ye({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:_+1}));return o}function fl(i,e,r){let a=0;for(const o of i)a+=Math.max(e,Math.min(r,o[1]))-Math.max(e,Math.min(r,o[0]));return a}function Kh(i,e,r){const a=[{fixed:-rn,stretch:0}];for(const[o,u]of i){const d=a[a.length-1];a.push({fixed:o-d.stretch,stretch:d.stretch}),a.push({fixed:o-d.stretch,stretch:d.stretch+(u-o)})}return a.push({fixed:e+rn,stretch:r}),a}function ml(i,e,r,a){return i/e*r+a}function gl(i,e,r,a){return i-e*r/a}class _l{constructor(e,r,a,o,u,d,f,_,x,b){if(this.boxStartIndex=e.length,x){let T=d.top,A=d.bottom;const C=d.collisionPadding;C&&(T-=C[1],A+=C[3]);let P=A-T;P>0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let T=d.top*f-_[0],A=d.bottom*f+_[2],C=d.left*f-_[3],P=d.right*f+_[1];const D=d.collisionPadding;if(D&&(C-=D[0]*f,T-=D[1]*f,P+=D[2]*f,A+=D[3]*f),b){const V=new Be(C,T),$=new Be(P,T),H=new Be(C,A),q=new Be(P,A),Y=b*Math.PI/180;V._rotate(Y),$._rotate(Y),H._rotate(Y),q._rotate(Y),C=Math.min(V.x,$.x,H.x,q.x),P=Math.max(V.x,$.x,H.x,q.x),T=Math.min(V.y,$.y,H.y,q.y),A=Math.max(V.y,$.y,H.y,q.y)}e.emplaceBack(r.x,r.y,C,T,P,A,a,o,u)}this.boxEndIndex=e.length}}class qp{constructor(e=[],r=Zp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:a}=this,o=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(a(o,d)>=0)break;r[e]=d,e=u}r[e]=o}_down(e){const{data:r,compare:a}=this,o=this.length>>1,u=r[e];for(;e<o;){let d=1+(e<<1),f=r[d];const _=d+1;if(_<this.length&&a(r[_],f)<0&&(d=_,f=r[_]),a(f,u)>=0)break;r[e]=f,e=d}r[e]=u}}function Zp(i,e){return i<e?-1:i>e?1:0}function Gp(i,e=1,r=!1){let a=1/0,o=1/0,u=-1/0,d=-1/0;const f=i[0];for(let C=0;C<f.length;C++){const P=f[C];(!C||P.x<a)&&(a=P.x),(!C||P.y<o)&&(o=P.y),(!C||P.x>u)&&(u=P.x),(!C||P.y>d)&&(d=P.y)}const _=Math.min(u-a,d-o);let x=_/2;const b=new qp([],Xp);if(_===0)return new Be(a,o);for(let C=a;C<u;C+=_)for(let P=o;P<d;P+=_)b.push(new sn(C+x,P+x,x,i));let T=function(C){let P=0,D=0,V=0;const $=C[0];for(let H=0,q=$.length,Y=q-1;H<q;Y=H++){const Q=$[H],oe=$[Y],be=Q.x*oe.y-oe.x*Q.y;D+=(Q.x+oe.x)*be,V+=(Q.y+oe.y)*be,P+=3*be}return new sn(D/P,V/P,0,C)}(i),A=b.length;for(;b.length;){const C=b.pop();(C.d>T.d||!T.d)&&(T=C,r&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,A)),C.max-T.d<=e||(x=C.h/2,b.push(new sn(C.p.x-x,C.p.y-x,x,i)),b.push(new sn(C.p.x+x,C.p.y-x,x,i)),b.push(new sn(C.p.x-x,C.p.y+x,x,i)),b.push(new sn(C.p.x+x,C.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${T.d}`)),T.p}function Xp(i,e){return e.max-i.max}function sn(i,e,r,a){this.p=new Be(i,e),this.h=r,this.d=function(o,u){let d=!1,f=1/0;for(let _=0;_<u.length;_++){const x=u[_];for(let b=0,T=x.length,A=T-1;b<T;A=b++){const C=x[b],P=x[A];C.y>o.y!=P.y>o.y&&o.x<(P.x-C.x)*(o.y-C.y)/(P.y-C.y)+C.x&&(d=!d),f=Math.min(f,zc(o,C,P))}}return(d?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Yt;c.aq=void 0,(Yt=c.aq||(c.aq={}))[Yt.center=1]="center",Yt[Yt.left=2]="left",Yt[Yt.right=3]="right",Yt[Yt.top=4]="top",Yt[Yt.bottom=5]="bottom",Yt[Yt["top-left"]=6]="top-left",Yt[Yt["top-right"]=7]="top-right",Yt[Yt["bottom-left"]=8]="bottom-left",Yt[Yt["bottom-right"]=9]="bottom-right";const Vs=7,_c=Number.POSITIVE_INFINITY;function Yh(i,e){return e[1]!==_c?function(r,a,o){let u=0,d=0;switch(a=Math.abs(a),o=Math.abs(o),r){case"top-right":case"top-left":case"top":d=o-Vs;break;case"bottom-right":case"bottom-left":case"bottom":d=-o+Vs}switch(r){case"top-right":case"bottom-right":case"right":u=-a;break;case"top-left":case"bottom-left":case"left":u=a}return[u,d]}(i,e[0],e[1]):function(r,a){let o=0,u=0;a<0&&(a=0);const d=a/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-Vs;break;case"bottom-right":case"bottom-left":u=-d+Vs;break;case"bottom":u=-a+Vs;break;case"top":u=a-Vs}switch(r){case"top-right":case"bottom-right":o=-d;break;case"top-left":case"bottom-left":o=d;break;case"left":o=a;break;case"right":o=-a}return[o,u]}(i,e[0])}function Jh(i,e,r){var a;const o=i.layout,u=(a=o.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let x=0;x<f.length;x+=2){const b=_[x]=f[x],T=f[x+1].map(A=>A*Rt);b.startsWith("top")?T[1]-=Vs:b.startsWith("bottom")&&(T[1]+=Vs),_[x+1]=T}return new Bi(_)}const d=o.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},r)*Rt,_c]:o.get("text-offset").evaluate(e,{},r).map(x=>x*Rt);const _=[];for(const x of d)_.push(x,Yh(x,f));return new Bi(_)}return null}function yc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Wp(i,e,r,a,o,u,d,f,_,x,b){let T=u.textMaxSize.evaluate(e,{});T===void 0&&(T=d);const A=i.layers[0].layout,C=A.get("icon-offset").evaluate(e,{},b),P=eu(r.horizontal),D=d/24,V=i.tilePixelRatio*D,$=i.tilePixelRatio*T/24,H=i.tilePixelRatio*f,q=i.tilePixelRatio*A.get("symbol-spacing"),Y=A.get("text-padding")*i.tilePixelRatio,Q=function(ue,ke,Ee,$e=1){const pt=ue.get("icon-padding").evaluate(ke,{},Ee),ft=pt&&pt.values;return[ft[0]*$e,ft[1]*$e,ft[2]*$e,ft[3]*$e]}(A,e,b,i.tilePixelRatio),oe=A.get("text-max-angle")/180*Math.PI,be=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ae=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",xe=A.get("symbol-placement"),ye=q/2,de=A.get("icon-text-fit");let Se;a&&de!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Se=wh(a,r.vertical,de,A.get("icon-text-fit-padding"),C,D)),P&&(a=wh(a,P,de,A.get("icon-text-fit-padding"),C,D)));const me=(ue,ke)=>{ke.x<0||ke.x>=zt||ke.y<0||ke.y>=zt||function(Ee,$e,pt,ft,Ft,Ui,gi,Dt,Xt,Jt,_i,yi,Ot,Vt,ai,xi,ni,Ei,Ci,Nt,Ge,oi,Qt,Ut,or){const br=Ee.addToLineVertexArray($e,pt);let wr,ls,lr,Gi,Pi=0,cs=0,uo=0,su=0,Ac=-1,Mc=-1;const hs={};let au=ss("");if(Ee.allowVerticalPlacement&&ft.vertical){const li=Dt.layout.get("text-rotate").evaluate(Ge,{},Ut)+90;lr=new _l(Xt,$e,Jt,_i,yi,ft.vertical,Ot,Vt,ai,li),gi&&(Gi=new _l(Xt,$e,Jt,_i,yi,gi,ni,Ei,ai,li))}if(Ft){const li=Dt.layout.get("icon-rotate").evaluate(Ge,{}),Xi=Dt.layout.get("icon-text-fit")!=="none",da=Hh(Ft,li,Qt,Xi),Tr=gi?Hh(gi,li,Qt,Xi):void 0;ls=new _l(Xt,$e,Jt,_i,yi,Ft,ni,Ei,!1,li),Pi=4*da.length;const fa=Ee.iconSizeData;let Nr=null;fa.kind==="source"?(Nr=[Vr*Dt.layout.get("icon-size").evaluate(Ge,{})],Nr[0]>Rs&&ti(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${oo}. Reduce your "icon-size".`)):fa.kind==="composite"&&(Nr=[Vr*oi.compositeIconSizes[0].evaluate(Ge,{},Ut),Vr*oi.compositeIconSizes[1].evaluate(Ge,{},Ut)],(Nr[0]>Rs||Nr[1]>Rs)&&ti(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${oo}. Reduce your "icon-size".`)),Ee.addSymbols(Ee.icon,da,Nr,Nt,Ci,Ge,c.ai.none,$e,br.lineStartIndex,br.lineLength,-1,Ut),Ac=Ee.icon.placedSymbolArray.length-1,Tr&&(cs=4*Tr.length,Ee.addSymbols(Ee.icon,Tr,Nr,Nt,Ci,Ge,c.ai.vertical,$e,br.lineStartIndex,br.lineLength,-1,Ut),Mc=Ee.icon.placedSymbolArray.length-1)}const nu=Object.keys(ft.horizontal);for(const li of nu){const Xi=ft.horizontal[li];if(!wr){au=ss(Xi.text);const Tr=Dt.layout.get("text-rotate").evaluate(Ge,{},Ut);wr=new _l(Xt,$e,Jt,_i,yi,Xi,Ot,Vt,ai,Tr)}const da=Xi.positionedLines.length===1;if(uo+=Qh(Ee,$e,Xi,Ui,Dt,ai,Ge,xi,br,ft.vertical?c.ai.horizontal:c.ai.horizontalOnly,da?nu:[li],hs,Ac,oi,Ut),da)break}ft.vertical&&(su+=Qh(Ee,$e,ft.vertical,Ui,Dt,ai,Ge,xi,br,c.ai.vertical,["vertical"],hs,Mc,oi,Ut));const Yp=wr?wr.boxStartIndex:Ee.collisionBoxArray.length,Jp=wr?wr.boxEndIndex:Ee.collisionBoxArray.length,Qp=lr?lr.boxStartIndex:Ee.collisionBoxArray.length,ed=lr?lr.boxEndIndex:Ee.collisionBoxArray.length,td=ls?ls.boxStartIndex:Ee.collisionBoxArray.length,id=ls?ls.boxEndIndex:Ee.collisionBoxArray.length,rd=Gi?Gi.boxStartIndex:Ee.collisionBoxArray.length,sd=Gi?Gi.boxEndIndex:Ee.collisionBoxArray.length;let Sr=-1;const xl=(li,Xi)=>li&&li.circleDiameter?Math.max(li.circleDiameter,Xi):Xi;Sr=xl(wr,Sr),Sr=xl(lr,Sr),Sr=xl(ls,Sr),Sr=xl(Gi,Sr);const ou=Sr>-1?1:0;ou&&(Sr*=or/Rt),Ee.glyphOffsetArray.length>=tn.MAX_GLYPHS&&ti("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ge.sortKey!==void 0&&Ee.addToSortKeyRanges(Ee.symbolInstances.length,Ge.sortKey);const ad=Jh(Dt,Ge,Ut),[nd,od]=function(li,Xi){const da=li.length,Tr=Xi==null?void 0:Xi.values;if((Tr==null?void 0:Tr.length)>0)for(let fa=0;fa<Tr.length;fa+=2){const Nr=Tr[fa+1];li.emplaceBack(c.aq[Tr[fa]],Nr[0],Nr[1])}return[da,li.length]}(Ee.textAnchorOffsets,ad);Ee.symbolInstances.emplaceBack($e.x,$e.y,hs.right>=0?hs.right:-1,hs.center>=0?hs.center:-1,hs.left>=0?hs.left:-1,hs.vertical||-1,Ac,Mc,au,Yp,Jp,Qp,ed,td,id,rd,sd,Jt,uo,su,Pi,cs,ou,0,Ot,Sr,nd,od)}(i,ke,ue,r,a,o,Se,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,V,[Y,Y,Y,Y],be,_,H,Q,Ae,C,e,u,x,b,d)};if(xe==="line")for(const ue of jh(e.geometry,0,0,zt,zt)){const ke=jp(ue,q,oe,r.vertical||P,a,24,$,i.overscaling,zt);for(const Ee of ke)P&&Hp(i,P.text,ye,Ee)||me(ue,Ee)}else if(xe==="line-center"){for(const ue of e.geometry)if(ue.length>1){const ke=$p(ue,oe,r.vertical||P,a,24,$);ke&&me(ue,ke)}}else if(e.type==="Polygon")for(const ue of Kl(e.geometry,0)){const ke=Gp(ue,16);me(ue[0],new Os(ke.x,ke.y,0))}else if(e.type==="LineString")for(const ue of e.geometry)me(ue,new Os(ue[0].x,ue[0].y,0));else if(e.type==="Point")for(const ue of e.geometry)for(const ke of ue)me([ke],new Os(ke.x,ke.y,0))}function Qh(i,e,r,a,o,u,d,f,_,x,b,T,A,C,P){const D=function(H,q,Y,Q,oe,be,Ae,xe){const ye=Q.layout.get("text-rotate").evaluate(be,{})*Math.PI/180,de=[];for(const Se of q.positionedLines)for(const me of Se.positionedGlyphs){if(!me.rect)continue;const ue=me.rect||{};let ke=mh+1,Ee=!0,$e=1,pt=0;const ft=(oe||xe)&&me.vertical,Ft=me.metrics.advance*me.scale/2;if(xe&&q.verticalizable&&(pt=Se.lineOffset/2-(me.imageName?-(Rt-me.metrics.width*me.scale)/2:(me.scale-1)*Rt)),me.imageName){const Nt=Ae[me.imageName];Ee=Nt.sdf,$e=Nt.pixelRatio,ke=Mi/$e}const Ui=oe?[me.x+Ft,me.y]:[0,0];let gi=oe?[0,0]:[me.x+Ft+Y[0],me.y+Y[1]-pt],Dt=[0,0];ft&&(Dt=gi,gi=[0,0]);const Xt=me.metrics.isDoubleResolution?2:1,Jt=(me.metrics.left-ke)*me.scale-Ft+gi[0],_i=(-me.metrics.top-ke)*me.scale+gi[1],yi=Jt+ue.w/Xt*me.scale/$e,Ot=_i+ue.h/Xt*me.scale/$e,Vt=new Be(Jt,_i),ai=new Be(yi,_i),xi=new Be(Jt,Ot),ni=new Be(yi,Ot);if(ft){const Nt=new Be(-Ft,Ft-ao),Ge=-Math.PI/2,oi=Rt/2-Ft,Qt=new Be(5-ao-oi,-(me.imageName?oi:0)),Ut=new Be(...Dt);Vt._rotateAround(Ge,Nt)._add(Qt)._add(Ut),ai._rotateAround(Ge,Nt)._add(Qt)._add(Ut),xi._rotateAround(Ge,Nt)._add(Qt)._add(Ut),ni._rotateAround(Ge,Nt)._add(Qt)._add(Ut)}if(ye){const Nt=Math.sin(ye),Ge=Math.cos(ye),oi=[Ge,-Nt,Nt,Ge];Vt._matMult(oi),ai._matMult(oi),xi._matMult(oi),ni._matMult(oi)}const Ei=new Be(0,0),Ci=new Be(0,0);de.push({tl:Vt,tr:ai,bl:xi,br:ni,tex:ue,writingMode:q.writingMode,glyphOffset:Ui,sectionIndex:me.sectionIndex,isSDF:Ee,pixelOffsetTL:Ei,pixelOffsetBR:Ci,minFontScaleX:0,minFontScaleY:0})}return de}(0,r,f,o,u,d,a,i.allowVerticalPlacement),V=i.textSizeData;let $=null;V.kind==="source"?($=[Vr*o.layout.get("text-size").evaluate(d,{})],$[0]>Rs&&ti(`${i.layerIds[0]}: Value for "text-size" is >= ${oo}. Reduce your "text-size".`)):V.kind==="composite"&&($=[Vr*C.compositeTextSizes[0].evaluate(d,{},P),Vr*C.compositeTextSizes[1].evaluate(d,{},P)],($[0]>Rs||$[1]>Rs)&&ti(`${i.layerIds[0]}: Value for "text-size" is >= ${oo}. Reduce your "text-size".`)),i.addSymbols(i.text,D,$,f,u,d,x,e,_.lineStartIndex,_.lineLength,A,P);for(const H of b)T[H]=i.text.placedSymbolArray.length-1;return 4*D.length}function eu(i){for(const e in i)return i[e];return null}function Hp(i,e,r,a){const o=i.compareText;if(e in o){const u=o[e];for(let d=u.length-1;d>=0;d--)if(a.dist(u[d])<r)return!0}else o[e]=[];return o[e].push(a),!1}const tu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class xc{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=a>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=tu[15&a];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new xc(f,d,u,e)}constructor(e,r=64,a=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=tu.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${a}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=r,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return vc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,a,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const b=_.pop()||0,T=_.pop()||0,A=_.pop()||0;if(T-A<=f){for(let V=A;V<=T;V++){const $=d[2*V],H=d[2*V+1];$>=e&&$<=a&&H>=r&&H<=o&&x.push(u[V])}continue}const C=A+T>>1,P=d[2*C],D=d[2*C+1];P>=e&&P<=a&&D>=r&&D<=o&&x.push(u[C]),(b===0?e<=P:r<=D)&&(_.push(A),_.push(C-1),_.push(1-b)),(b===0?a>=P:o>=D)&&(_.push(C+1),_.push(T),_.push(1-b))}return x}within(e,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:d}=this,f=[0,o.length-1,0],_=[],x=a*a;for(;f.length;){const b=f.pop()||0,T=f.pop()||0,A=f.pop()||0;if(T-A<=d){for(let V=A;V<=T;V++)ru(u[2*V],u[2*V+1],e,r)<=x&&_.push(o[V]);continue}const C=A+T>>1,P=u[2*C],D=u[2*C+1];ru(P,D,e,r)<=x&&_.push(o[C]),(b===0?e-a<=P:r-a<=D)&&(f.push(A),f.push(C-1),f.push(1-b)),(b===0?e+a>=P:r+a>=D)&&(f.push(C+1),f.push(T),f.push(1-b))}return _}}function vc(i,e,r,a,o,u){if(o-a<=r)return;const d=a+o>>1;iu(i,e,d,a,o,u),vc(i,e,r,a,d-1,1-u),vc(i,e,r,d+1,o,1-u)}function iu(i,e,r,a,o,u){for(;o>a;){if(o-a>600){const x=o-a+1,b=r-a+1,T=Math.log(x),A=.5*Math.exp(2*T/3),C=.5*Math.sqrt(T*A*(x-A)/x)*(b-x/2<0?-1:1);iu(i,e,r,Math.max(a,Math.floor(r-b*A/x+C)),Math.min(o,Math.floor(r+(x-b)*A/x+C)),u)}const d=e[2*r+u];let f=a,_=o;for(co(i,e,a,r),e[2*o+u]>d&&co(i,e,a,o);f<_;){for(co(i,e,f,_),f++,_--;e[2*f+u]<d;)f++;for(;e[2*_+u]>d;)_--}e[2*a+u]===d?co(i,e,a,_):(_++,co(i,e,_,o)),_<=r&&(a=_+1),r<=_&&(o=_-1)}}function co(i,e,r,a){bc(i,r,a),bc(e,2*r,2*a),bc(e,2*r+1,2*a+1)}function bc(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}function ru(i,e,r,a){const o=i-r,u=e-a;return o*o+u*u}var wc;c.bh=void 0,(wc=c.bh||(c.bh={})).create="create",wc.load="load",wc.fullLoad="fullLoad";let yl=null,ho=[];const Sc=1e3/60,Tc="loadTime",Ic="fullLoadTime",Kp={mark(i){performance.mark(i)},frame(i){const e=i;yl!=null&&ho.push(e-yl),yl=e},clearMetrics(){yl=null,ho=[],performance.clearMeasures(Tc),performance.clearMeasures(Ic);for(const i in c.bh)performance.clearMarks(c.bh[i])},getPerformanceMetrics(){performance.measure(Tc,c.bh.create,c.bh.load),performance.measure(Ic,c.bh.create,c.bh.fullLoad);const i=performance.getEntriesByName(Tc)[0].duration,e=performance.getEntriesByName(Ic)[0].duration,r=ho.length,a=1/(ho.reduce((u,d)=>u+d,0)/r/1e3),o=ho.filter(u=>u>Sc).reduce((u,d)=>u+(d-Sc)/Sc,0);return{loadTime:i,fullLoadTime:e,fps:a,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};c.$=function(i,e,r){var a,o,u,d,f,_,x,b,T,A,C,P,D=r[0],V=r[1],$=r[2];return e===i?(i[12]=e[0]*D+e[4]*V+e[8]*$+e[12],i[13]=e[1]*D+e[5]*V+e[9]*$+e[13],i[14]=e[2]*D+e[6]*V+e[10]*$+e[14],i[15]=e[3]*D+e[7]*V+e[11]*$+e[15]):(o=e[1],u=e[2],d=e[3],f=e[4],_=e[5],x=e[6],b=e[7],T=e[8],A=e[9],C=e[10],P=e[11],i[0]=a=e[0],i[1]=o,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=x,i[7]=b,i[8]=T,i[9]=A,i[10]=C,i[11]=P,i[12]=a*D+f*V+T*$+e[12],i[13]=o*D+_*V+A*$+e[13],i[14]=u*D+x*V+C*$+e[14],i[15]=d*D+b*V+P*$+e[15]),i},c.A=Ha,c.B=wi,c.C=class{constructor(i,e,r){this.receive=a=>{const o=a.data,u=o.id;if(u&&(!o.targetMapId||this.mapId===o.targetMapId))if(o.type==="<cancel>"){delete this.tasks[u];const d=this.cancelCallbacks[u];delete this.cancelCallbacks[u],d&&d()}else ki()||o.mustQueue?(this.tasks[u]=o,this.taskQueue.push(u),this.invoker.trigger()):this.processTask(u,o)},this.process=()=>{if(!this.taskQueue.length)return;const a=this.taskQueue.shift(),o=this.tasks[a];delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),o&&this.processTask(a,o)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Np(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ki()?i:window}send(i,e,r,a,o=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=[],f={id:u,type:i,hasCallback:!!r,targetMapId:a,mustQueue:o,sourceMapId:this.mapId,data:Rr(e,d)};return this.target.postMessage(f,{transfer:d}),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Ps(e.error)):r(null,Ps(e.data)))}else{let r=!1;const a=[],o=e.hasCallback?(f,_)=>{r=!0,delete this.cancelCallbacks[i];const x={id:i,type:"<response>",sourceMapId:this.mapId,error:f?Rr(f):null,data:Rr(_,a)};this.target.postMessage(x,{transfer:a})}:f=>{r=!0};let u=null;const d=Ps(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,o);else if("getWorkerSource"in this.parent){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,o)}else o(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.D=Ce,c.E=Gr,c.F=function(i,e){const r={};for(let a=0;a<e.length;a++){const o=e[a];o in i&&(r[o]=i[o])}return r},c.G=kh,c.H=zh,c.I=nc,c.J=ma,c.K=Ir,c.L=Fs,c.M=Zs,c.N=zt,c.O=Zi,c.P=Be,c.Q=xt,c.R=qi,c.S=ut,c.T=Xo,c.U=dl,c.V=class extends is{},c.W=gc,c.X=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let a=0;a<i.length;a++){const o=window.document.createElement("source");ur(i[a])||(r.crossOrigin="Anonymous"),o.src=i[a],r.appendChild(o)}return{cancel:()=>{}}},c.Y=fe,c.Z=function(){var i=new Ha(16);return Ha!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},c._=Wi,c.a=qs,c.a$=class extends E{},c.a0=function(i,e,r){var a=r[0],o=r[1],u=r[2];return i[0]=e[0]*a,i[1]=e[1]*a,i[2]=e[2]*a,i[3]=e[3]*a,i[4]=e[4]*o,i[5]=e[5]*o,i[6]=e[6]*o,i[7]=e[7]*o,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.a1=Rc,c.a2=function(){return ga++},c.a3=F,c.a4=tn,c.a5=function(){Ii.isLoading()||Ii.isLoaded()||On()!=="deferred"||Go()},c.a6=Mn,c.a7=ua,c.a8=ht,c.a9=Vh,c.aA=aa,c.aB=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=Di(i[r],e[i[r].ref]));return i},c.aC=function(i){if(i.type==="custom")return new Vp(i);switch(i.type){case"background":return new Rp(i);case"circle":return new bu(i);case"fill":return new Uu(i);case"fill-extrusion":return new ip(i);case"heatmap":return new Su(i);case"hillshade":return new Iu(i);case"line":return new hp(i);case"raster":return new Op(i);case"symbol":return new pl(i)}},c.aD=$i,c.aE=function(i,e){if(!i)return[{command:Ye.setStyle,args:[e]}];let r=[];try{if(!nt(i.version,e.version))return[{command:Ye.setStyle,args:[e]}];nt(i.center,e.center)||r.push({command:Ye.setCenter,args:[e.center]}),nt(i.zoom,e.zoom)||r.push({command:Ye.setZoom,args:[e.zoom]}),nt(i.bearing,e.bearing)||r.push({command:Ye.setBearing,args:[e.bearing]}),nt(i.pitch,e.pitch)||r.push({command:Ye.setPitch,args:[e.pitch]}),nt(i.sprite,e.sprite)||r.push({command:Ye.setSprite,args:[e.sprite]}),nt(i.glyphs,e.glyphs)||r.push({command:Ye.setGlyphs,args:[e.glyphs]}),nt(i.transition,e.transition)||r.push({command:Ye.setTransition,args:[e.transition]}),nt(i.light,e.light)||r.push({command:Ye.setLight,args:[e.light]});const a={},o=[];(function(d,f,_,x){let b;for(b in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,b)&&(Object.prototype.hasOwnProperty.call(f,b)||ys(b,_,x));for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(Object.prototype.hasOwnProperty.call(d,b)?nt(d[b],f[b])||(d[b].type==="geojson"&&f[b].type==="geojson"&&ya(d,f,b)?_.push({command:Ye.setGeoJSONSourceData,args:[b,f[b].data]}):pr(b,f,_,x)):Ji(b,f,_))})(i.sources,e.sources,o,a);const u=[];i.layers&&i.layers.forEach(d=>{a[d.source]?r.push({command:Ye.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(o),function(d,f,_){f=f||[];const x=(d=d||[]).map(kr),b=f.map(kr),T=d.reduce(Xr,{}),A=f.reduce(Xr,{}),C=x.slice(),P=Object.create(null);let D,V,$,H,q,Y,Q;for(D=0,V=0;D<x.length;D++)$=x[D],Object.prototype.hasOwnProperty.call(A,$)?V++:(_.push({command:Ye.removeLayer,args:[$]}),C.splice(C.indexOf($,V),1));for(D=0,V=0;D<b.length;D++)$=b[b.length-1-D],C[C.length-1-D]!==$&&(Object.prototype.hasOwnProperty.call(T,$)?(_.push({command:Ye.removeLayer,args:[$]}),C.splice(C.lastIndexOf($,C.length-V),1)):V++,Y=C[C.length-D],_.push({command:Ye.addLayer,args:[A[$],Y]}),C.splice(C.length-D,0,$),P[$]=!0);for(D=0;D<b.length;D++)if($=b[D],H=T[$],q=A[$],!P[$]&&!nt(H,q))if(nt(H.source,q.source)&&nt(H["source-layer"],q["source-layer"])&&nt(H.type,q.type)){for(Q in xs(H.layout,q.layout,_,$,null,Ye.setLayoutProperty),xs(H.paint,q.paint,_,$,null,Ye.setPaintProperty),nt(H.filter,q.filter)||_.push({command:Ye.setFilter,args:[$,q.filter]}),nt(H.minzoom,q.minzoom)&&nt(H.maxzoom,q.maxzoom)||_.push({command:Ye.setLayerZoomRange,args:[$,q.minzoom,q.maxzoom]}),H)Object.prototype.hasOwnProperty.call(H,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?xs(H[Q],q[Q],_,$,Q.slice(6),Ye.setPaintProperty):nt(H[Q],q[Q])||_.push({command:Ye.setLayerProperty,args:[$,Q,q[Q]]}));for(Q in q)Object.prototype.hasOwnProperty.call(q,Q)&&!Object.prototype.hasOwnProperty.call(H,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?xs(H[Q],q[Q],_,$,Q.slice(6),Ye.setPaintProperty):nt(H[Q],q[Q])||_.push({command:Ye.setLayerProperty,args:[$,Q,q[Q]]}))}else _.push({command:Ye.removeLayer,args:[$]}),Y=C[C.lastIndexOf($)+1],_.push({command:Ye.addLayer,args:[q,Y]})}(u,e.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:Ye.setStyle,args:[e]}]}return r},c.aF=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},c.aG=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!i(e[a],r[a]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const a in e)if(!i(e[a],r[a]))return!1;return!0}return e===r},c.aH=mt,c.aI=fs,c.aJ=na,c.aK=function(i){return i({pluginStatus:di,pluginURL:Fr}),na.on("pluginStateChange",i),i},c.aL=class extends as{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.aM=Xa,c.aN=class extends as{constructor(i,e){super(i,e),this.current=Ol}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.aO=Yo,c.aP=class extends as{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.aQ=class extends as{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.aR=Jo,c.aS=function(i,e,r,a,o,u,d){var f=1/(e-r),_=1/(a-o),x=1/(u-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*f,i[13]=(o+a)*_,i[14]=(d+u)*x,i[15]=1,i},c.aT=it,c.aU=vu,c.aV=class extends n{},c.aW=fp,c.aX=class extends p{},c.aY=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},c.aZ=Uc,c.a_=pe,c.aa=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,o,u)=>{const d=o||u;return e[a]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},c.ab=function(i,e){const r=[];for(const a in i)a in e||r.push(a);return r},c.ac=function(i){if(jr==null){const e=i.navigator?i.navigator.userAgent:null;jr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return jr},c.ad=Ki,c.ae=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[0],d=e[1],f=e[2],_=e[3],x=e[4],b=e[5],T=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*o+x*a,i[1]=d*o+b*a,i[2]=f*o+T*a,i[3]=_*o+A*a,i[4]=x*o-u*a,i[5]=b*o-d*a,i[6]=T*o-f*a,i[7]=A*o-_*a,i},c.af=function(i){var e=new Ha(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.ag=il,c.ah=function(i,e){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:o,minZoom:u,maxZoom:d}=i,f=o?Ki(Si.interpolationFactor(o,e,u,d),0,1):0;i.kind==="camera"?a=wi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},c.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:a,upperSize:o}){return i.kind==="source"?a/Vr:i.kind==="composite"?wi.number(a/Vr,o/Vr,r):e},c.ak=hc,c.al=function(i,e,r,a){const o=e.y-i.y,u=e.x-i.x,d=a.y-r.y,f=a.x-r.x,_=d*u-f*o;if(_===0)return null;const x=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new Be(i.x+x*u,i.y+x*o)},c.am=jh,c.an=Pc,c.ao=jl,c.ap=Rt,c.ar=cc,c.as=function(i,e){var r=e[0],a=e[1],o=e[2],u=e[3],d=e[4],f=e[5],_=e[6],x=e[7],b=e[8],T=e[9],A=e[10],C=e[11],P=e[12],D=e[13],V=e[14],$=e[15],H=r*f-a*d,q=r*_-o*d,Y=r*x-u*d,Q=a*_-o*f,oe=a*x-u*f,be=o*x-u*_,Ae=b*D-T*P,xe=b*V-A*P,ye=b*$-C*P,de=T*V-A*D,Se=T*$-C*D,me=A*$-C*V,ue=H*me-q*Se+Y*de+Q*ye-oe*xe+be*Ae;return ue?(i[0]=(f*me-_*Se+x*de)*(ue=1/ue),i[1]=(o*Se-a*me-u*de)*ue,i[2]=(D*be-V*oe+$*Q)*ue,i[3]=(A*oe-T*be-C*Q)*ue,i[4]=(_*ye-d*me-x*xe)*ue,i[5]=(r*me-o*ye+u*xe)*ue,i[6]=(V*Y-P*be-$*q)*ue,i[7]=(b*be-A*Y+C*q)*ue,i[8]=(d*Se-f*ye+x*Ae)*ue,i[9]=(a*ye-r*Se-u*Ae)*ue,i[10]=(P*oe-D*Y+$*H)*ue,i[11]=(T*Y-b*oe-C*H)*ue,i[12]=(f*xe-d*de-_*Ae)*ue,i[13]=(r*de-a*xe+o*Ae)*ue,i[14]=(D*q-P*Q-V*H)*ue,i[15]=(b*Q-T*q+A*H)*ue,i):null},c.at=yc,c.au=lc,c.av=xc,c.aw=function(){const i={},e=re.$version;for(const r in re.$root){const a=re.$root[r];if(a.required){let o=null;o=r==="version"?e:a.type==="array"?[]:{},o!=null&&(i[r]=o)}}return i},c.ax=Ye,c.ay=$o,c.az=ji,c.b=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(a=>{e(null,a)}).catch(a=>{e(new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},c.b0=Zt,c.b1=function(i,e){var r=i[0],a=i[1],o=i[2],u=i[3],d=i[4],f=i[5],_=i[6],x=i[7],b=i[8],T=i[9],A=i[10],C=i[11],P=i[12],D=i[13],V=i[14],$=i[15],H=e[0],q=e[1],Y=e[2],Q=e[3],oe=e[4],be=e[5],Ae=e[6],xe=e[7],ye=e[8],de=e[9],Se=e[10],me=e[11],ue=e[12],ke=e[13],Ee=e[14],$e=e[15];return Math.abs(r-H)<=mi*Math.max(1,Math.abs(r),Math.abs(H))&&Math.abs(a-q)<=mi*Math.max(1,Math.abs(a),Math.abs(q))&&Math.abs(o-Y)<=mi*Math.max(1,Math.abs(o),Math.abs(Y))&&Math.abs(u-Q)<=mi*Math.max(1,Math.abs(u),Math.abs(Q))&&Math.abs(d-oe)<=mi*Math.max(1,Math.abs(d),Math.abs(oe))&&Math.abs(f-be)<=mi*Math.max(1,Math.abs(f),Math.abs(be))&&Math.abs(_-Ae)<=mi*Math.max(1,Math.abs(_),Math.abs(Ae))&&Math.abs(x-xe)<=mi*Math.max(1,Math.abs(x),Math.abs(xe))&&Math.abs(b-ye)<=mi*Math.max(1,Math.abs(b),Math.abs(ye))&&Math.abs(T-de)<=mi*Math.max(1,Math.abs(T),Math.abs(de))&&Math.abs(A-Se)<=mi*Math.max(1,Math.abs(A),Math.abs(Se))&&Math.abs(C-me)<=mi*Math.max(1,Math.abs(C),Math.abs(me))&&Math.abs(P-ue)<=mi*Math.max(1,Math.abs(P),Math.abs(ue))&&Math.abs(D-ke)<=mi*Math.max(1,Math.abs(D),Math.abs(ke))&&Math.abs(V-Ee)<=mi*Math.max(1,Math.abs(V),Math.abs(Ee))&&Math.abs($-$e)<=mi*Math.max(1,Math.abs($),Math.abs($e))},c.b2=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.b3=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},c.b4=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},c.b5=js,c.b6=Rh,c.b7=Dh,c.b8=function(i,e,r,a,o){var u,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,o!=null&&o!==1/0?(i[10]=(o+a)*(u=1/(a-o)),i[14]=2*o*a*u):(i[10]=-1,i[14]=-2*a),i},c.b9=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[4],d=e[5],f=e[6],_=e[7],x=e[8],b=e[9],T=e[10],A=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*o+x*a,i[5]=d*o+b*a,i[6]=f*o+T*a,i[7]=_*o+A*a,i[8]=x*o-u*a,i[9]=b*o-d*a,i[10]=T*o-f*a,i[11]=A*o-_*a,i},c.bA=Hi,c.bB=lh,c.bC=Ra,c.bD=Ii,c.ba=$s,c.bb=ds,c.bc=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},c.bd=class extends ca{},c.be=fc,c.bf=Lh,c.bg=Kp,c.bi=Mr,c.bj=function(i,e,r=!1){if(di===Dn||di===Ln||di===Bn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Fr=ms.resolveURL(i),di=Dn,Rn=e,Fn(),r||Go()},c.bk=On,c.bl=function(i,e){const r={};for(let o=0;o<i.length;o++){const u=e&&e[i[o].id]||Na(i[o]);e&&(e[i[o].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[o])}const a=[];for(const o in r)a.push(r[o]);return a},c.bm=we,c.bn=Oh,c.bo=Nh,c.bp=_h,c.bq=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=zt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,a=e._unevaluatedLayout._values,o={layoutIconSize:a["icon-size"].possiblyEvaluate(new ht(i.bucket.zoom+1),i.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ht(i.bucket.zoom+1),i.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ht(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:b}=i.bucket.textSizeData;o.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ht(x),i.canonical),a["text-size"].possiblyEvaluate(new ht(b),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:b}=i.bucket.iconSizeData;o.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ht(x),i.canonical),a["icon-size"].possiblyEvaluate(new ht(b),i.canonical)]}const u=r.get("text-line-height")*Rt,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const b=r.get("text-font").evaluate(x,{},i.canonical).join(","),T=_.evaluate(x,{},i.canonical),A=o.layoutTextSize.evaluate(x,{},i.canonical),C=o.layoutIconSize.evaluate(x,{},i.canonical),P={horizontal:{},vertical:void 0},D=x.text;let V,$=[0,0];if(D){const Y=D.toString(),Q=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*Rt,oe=kn(Y)?Q:0,be=r.get("text-anchor").evaluate(x,{},i.canonical),Ae=Jh(e,x,i.canonical);if(!Ae){const me=r.get("text-radial-offset").evaluate(x,{},i.canonical);$=me?Yh(be,[me*Rt,_c]):r.get("text-offset").evaluate(x,{},i.canonical).map(ue=>ue*Rt)}let xe=d?"center":r.get("text-justify").evaluate(x,{},i.canonical);const ye=r.get("symbol-placement"),de=ye==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*Rt:0,Se=()=>{i.bucket.allowVerticalPlacement&&Pn(Y)&&(P.vertical=cl(D,i.glyphMap,i.glyphPositions,i.imagePositions,b,de,u,be,"left",oe,$,c.ai.vertical,!0,ye,A,T))};if(!d&&Ae){const me=new Set;if(xe==="auto")for(let ke=0;ke<Ae.values.length;ke+=2)me.add(yc(Ae.values[ke]));else me.add(xe);let ue=!1;for(const ke of me)if(!P.horizontal[ke])if(ue)P.horizontal[ke]=P.horizontal[0];else{const Ee=cl(D,i.glyphMap,i.glyphPositions,i.imagePositions,b,de,u,"center",ke,oe,$,c.ai.horizontal,!1,ye,A,T);Ee&&(P.horizontal[ke]=Ee,ue=Ee.positionedLines.length===1)}Se()}else{xe==="auto"&&(xe=yc(be));const me=cl(D,i.glyphMap,i.glyphPositions,i.imagePositions,b,de,u,be,xe,oe,$,c.ai.horizontal,!1,ye,A,T);me&&(P.horizontal[xe]=me),Se(),Pn(Y)&&d&&f&&(P.vertical=cl(D,i.glyphMap,i.glyphPositions,i.imagePositions,b,de,u,be,xe,oe,$,c.ai.vertical,!1,ye,A,T))}}let H=!1;if(x.icon&&x.icon.name){const Y=i.imageMap[x.icon.name];Y&&(V=kp(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),H=!!Y.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=H:i.bucket.sdfIcons!==H&&ti("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Y.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const q=eu(P.horizontal)||P.vertical;i.bucket.iconsInText=!!q&&q.iconsInText,(q||V)&&Wp(i.bucket,x,P,V,i.imageMap,o,A,C,$,H,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},c.br=ic,c.bs=Ql,c.bt=tc,c.bu=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},c.bv=sc,c.bw=Ls,c.bx=function(i,e,r,a,o){return Wi(this,void 0,void 0,function*(){if(Ir())try{return yield Zs(i,e,r,a,o)}catch{}return function(u,d,f,_,x){const b=u.width,T=u.height;Yi&&ct||(Yi=new OffscreenCanvas(b,T),ct=Yi.getContext("2d",{willReadFrequently:!0})),Yi.width=b,Yi.height=T,ct.drawImage(u,0,0,b,T);const A=ct.getImageData(d,f,_,x);return ct.clearRect(0,0,b,T),A.data}(i,e,r,a,o)})},c.by=Fh,c.bz=ie,c.c=gs,c.d=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=_a})},r.onerror=()=>e(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 a=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(a):_a},c.e=$t,c.f=function(i,e){return Er($t(i,{type:"json"}),e)},c.g=zi,c.h=ms,c.i=ki,c.j=Pr,c.k=Cr,c.l=Xs,c.m=Er,c.n=function(i){return new sc(i).readFields(Ip,[])},c.o=function(i,e,r){if(!i.length)return r(null,[]);let a=i.length;const o=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(_,x)=>{_&&(u=_),o[f]=x,--a==0&&r(u,o)})})},c.p=gh,c.q=Yn,c.r=Mt,c.s=ur,c.t=Ll,c.u=ve,c.v=re,c.w=ti,c.x=ja,c.y=yr,c.z=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}}}),Ns(["./shared"],function(c){class Wi{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,M){for(const O of I){this._layerConfigs[O.id]=O;const N=this._layers[O.id]=c.aC(O);N._featureFilter=c.a6(N.filter),this.keyCache[O.id]&&delete this.keyCache[O.id]}for(const O of M)delete this.keyCache[O],delete this._layerConfigs[O],delete this._layers[O];this.familiesBySource={};const k=c.bl(Object.values(this._layerConfigs),this.keyCache);for(const O of k){const N=O.map(ae=>this._layers[ae.id]),K=N[0];if(K.visibility==="none")continue;const Z=K.source||"";let j=this.familiesBySource[Z];j||(j=this.familiesBySource[Z]={});const W=K.sourceLayer||"_geojsonTileLayer";let se=j[W];se||(se=j[W]=[]),se.push(N)}}}class ie{constructor(I){const M={},k=[];for(const Z in I){const j=I[Z],W=M[Z]={};for(const se in j){const ae=j[+se];if(!ae||ae.bitmap.width===0||ae.bitmap.height===0)continue;const le={x:0,y:0,w:ae.bitmap.width+2,h:ae.bitmap.height+2};k.push(le),W[se]={rect:le,metrics:ae.metrics}}}const{w:O,h:N}=c.p(k),K=new c.q({width:O||1,height:N||1});for(const Z in I){const j=I[Z];for(const W in j){const se=j[+W];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;const ae=M[Z][W].rect;c.q.copy(se.bitmap,K,{x:0,y:0},{x:ae.x+1,y:ae.y+1},se.bitmap)}}this.image=K,this.positions=M}}c.bm("GlyphAtlas",ie);class Hi{constructor(I){this.tileID=new c.O(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(I,M,k,O,N){this.status="parsing",this.data=I,this.collisionBoxArray=new c.a3;const K=new c.bn(Object.keys(I.layers).sort()),Z=new c.bo(this.tileID,this.promoteId);Z.bucketLayerIDs=[];const j={},W={featureIndex:Z,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:k},se=M.familiesBySource[this.source];for(const Ke in se){const He=I.layers[Ke];if(!He)continue;He.version===1&&c.w(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Wt=K.encode(Ke),ot=[];for(let kt=0;kt<He.length;kt++){const jt=He.feature(kt),Li=Z.getId(jt,Ke);ot.push({feature:jt,id:Li,index:kt,sourceLayerIndex:Wt})}for(const kt of se[Ke]){const jt=kt[0];jt.source!==this.source&&c.w(`layer.source = ${jt.source} does not equal this.source = ${this.source}`),jt.minzoom&&this.zoom<Math.floor(jt.minzoom)||jt.maxzoom&&this.zoom>=jt.maxzoom||jt.visibility!=="none"&&(ci(kt,this.zoom,k),(j[jt.id]=jt.createBucket({index:Z.bucketLayerIDs.length,layers:kt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Wt,sourceID:this.source})).populate(ot,W,this.tileID.canonical),Z.bucketLayerIDs.push(kt.map(Li=>Li.id)))}}let ae,le,Pe,Re;const Te=c.aH(W.glyphDependencies,Ke=>Object.keys(Ke).map(Number));this.inFlightDependencies.forEach(Ke=>Ke==null?void 0:Ke.cancel()),this.inFlightDependencies=[];const ze=++this.dependencySentinel;Object.keys(Te).length?this.inFlightDependencies.push(O.send("getGlyphs",{uid:this.uid,stacks:Te,source:this.source,tileID:this.tileID,type:"glyphs"},(Ke,He)=>{ze===this.dependencySentinel&&(ae||(ae=Ke,le=He,st.call(this)))})):le={};const Oe=Object.keys(W.iconDependencies);Oe.length?this.inFlightDependencies.push(O.send("getImages",{icons:Oe,source:this.source,tileID:this.tileID,type:"icons"},(Ke,He)=>{ze===this.dependencySentinel&&(ae||(ae=Ke,Pe=He,st.call(this)))})):Pe={};const tt=Object.keys(W.patternDependencies);function st(){if(ae)return N(ae);if(le&&Pe&&Re){const Ke=new ie(le),He=new c.bp(Pe,Re);for(const Wt in j){const ot=j[Wt];ot instanceof c.a4?(ci(ot.layers,this.zoom,k),c.bq({bucket:ot,glyphMap:le,glyphPositions:Ke.positions,imageMap:Pe,imagePositions:He.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ot.hasPattern&&(ot instanceof c.br||ot instanceof c.bs||ot instanceof c.bt)&&(ci(ot.layers,this.zoom,k),ot.addFeatures(W,this.tileID.canonical,He.patternPositions))}this.status="done",N(null,{buckets:Object.values(j).filter(Wt=>!Wt.isEmpty()),featureIndex:Z,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ke.image,imageAtlas:He,glyphMap:this.returnDependencies?le:null,iconMap:this.returnDependencies?Pe:null,glyphPositions:this.returnDependencies?Ke.positions:null})}}tt.length?this.inFlightDependencies.push(O.send("getImages",{icons:tt,source:this.source,tileID:this.tileID,type:"patterns"},(Ke,He)=>{ze===this.dependencySentinel&&(ae||(ae=Ke,Re=He,st.call(this)))})):Re={},st.call(this)}}function ci(R,I,M){const k=new c.a8(I);for(const O of R)O.recalculate(k,M)}function Be(R,I){const M=c.l(R.request,(k,O,N,K)=>{if(k)I(k);else if(O)try{const Z=new c.bw.VectorTile(new c.bv(O));I(null,{vectorTile:Z,rawData:O,cacheControl:N,expires:K})}catch(Z){const j=new Uint8Array(O);let W=`Unable to parse the tile at ${R.request.url}, `;W+=j[0]===31&&j[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Z.messge}`,I(new Error(W))}});return()=>{M.cancel(),I()}}class us{constructor(I,M,k,O){this.actor=I,this.layerIndex=M,this.availableImages=k,this.loadVectorData=O||Be,this.fetching={},this.loading={},this.loaded={}}loadTile(I,M){const k=I.uid;this.loading||(this.loading={});const O=!!(I&&I.request&&I.request.collectResourceTiming)&&new c.bu(I.request),N=this.loading[k]=new Hi(I);N.abort=this.loadVectorData(I,(K,Z)=>{if(delete this.loading[k],K||!Z)return N.status="done",this.loaded[k]=N,M(K);const j=Z.rawData,W={};Z.expires&&(W.expires=Z.expires),Z.cacheControl&&(W.cacheControl=Z.cacheControl);const se={};if(O){const ae=O.finish();ae&&(se.resourceTiming=JSON.parse(JSON.stringify(ae)))}N.vectorTile=Z.vectorTile,N.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,(ae,le)=>{if(delete this.fetching[k],ae||!le)return M(ae);M(null,c.e({rawTileData:j.slice(0)},le,W,se))}),this.loaded=this.loaded||{},this.loaded[k]=N,this.fetching[k]={rawTileData:j,cacheControl:W,resourceTiming:se}})}reloadTile(I,M){const k=this.loaded,O=I.uid;if(k&&k[O]){const N=k[O];N.showCollisionBoxes=I.showCollisionBoxes,N.status==="parsing"?N.parse(N.vectorTile,this.layerIndex,this.availableImages,this.actor,(K,Z)=>{if(K||!Z)return M(K,Z);let j;if(this.fetching[O]){const{rawTileData:W,cacheControl:se,resourceTiming:ae}=this.fetching[O];delete this.fetching[O],j=c.e({rawTileData:W.slice(0)},Z,se,ae)}else j=Z;M(null,j)}):N.status==="done"&&(N.vectorTile?N.parse(N.vectorTile,this.layerIndex,this.availableImages,this.actor,M):M())}}abortTile(I,M){const k=this.loading,O=I.uid;k&&k[O]&&k[O].abort&&(k[O].abort(),delete k[O]),M()}removeTile(I,M){const k=this.loaded,O=I.uid;k&&k[O]&&delete k[O],M()}}class Us{constructor(){this.loaded={}}loadTile(I,M){return c._(this,void 0,void 0,function*(){const{uid:k,encoding:O,rawImageData:N,redFactor:K,greenFactor:Z,blueFactor:j,baseShift:W}=I,se=N.width+2,ae=N.height+2,le=c.a(N)?new c.R({width:se,height:ae},yield c.bx(N,-1,-1,se,ae)):N,Pe=new c.by(k,le,O,K,Z,j,W);this.loaded=this.loaded||{},this.loaded[k]=Pe,M(null,Pe)})}removeTile(I){const M=this.loaded,k=I.uid;M&&M[k]&&delete M[k]}}function ps(R,I){if(R.length!==0){ei(R[0],I);for(var M=1;M<R.length;M++)ei(R[M],!I)}}function ei(R,I){for(var M=0,k=0,O=0,N=R.length,K=N-1;O<N;K=O++){var Z=(R[O][0]-R[K][0])*(R[K][1]+R[O][1]),j=M+Z;k+=Math.abs(M)>=Math.abs(Z)?M-j+Z:Z-j+M,M=j}M+k>=0!=!!I&&R.reverse()}var Pt=c.bz(function R(I,M){var k,O=I&&I.type;if(O==="FeatureCollection")for(k=0;k<I.features.length;k++)R(I.features[k],M);else if(O==="GeometryCollection")for(k=0;k<I.geometries.length;k++)R(I.geometries[k],M);else if(O==="Feature")R(I.geometry,M);else if(O==="Polygon")ps(I.coordinates,M);else if(O==="MultiPolygon")for(k=0;k<I.coordinates.length;k++)ps(I.coordinates[k],M);return I});const ma=c.bw.VectorTileFeature.prototype.toGeoJSON;var Ir={exports:{}},$s=c.bA,ds=c.bw.VectorTileFeature,Ki=js;function js(R,I){this.options=I||{},this.features=R,this.length=R.length}function $t(R,I){this.id=typeof R.id=="number"?R.id:void 0,this.type=R.type,this.rawGeometry=R.type===1?[R.geometry]:R.geometry,this.properties=R.tags,this.extent=I||4096}js.prototype.feature=function(R){return new $t(this.features[R],this.options.extent)},$t.prototype.loadGeometry=function(){var R=this.rawGeometry;this.geometry=[];for(var I=0;I<R.length;I++){for(var M=R[I],k=[],O=0;O<M.length;O++)k.push(new $s(M[O][0],M[O][1]));this.geometry.push(k)}return this.geometry},$t.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var R=this.geometry,I=1/0,M=-1/0,k=1/0,O=-1/0,N=0;N<R.length;N++)for(var K=R[N],Z=0;Z<K.length;Z++){var j=K[Z];I=Math.min(I,j.x),M=Math.max(M,j.x),k=Math.min(k,j.y),O=Math.max(O,j.y)}return[I,k,M,O]},$t.prototype.toGeoJSON=ds.prototype.toGeoJSON;var ga=c.bB,mt=Ki;function fs(R){var I=new ga;return function(M,k){for(var O in M.layers)k.writeMessage(3,$i,M.layers[O])}(R,I),I.finish()}function $i(R,I){var M;I.writeVarintField(15,R.version||1),I.writeStringField(1,R.name||""),I.writeVarintField(5,R.extent||4096);var k={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<R.length;M++)k.feature=R.feature(M),I.writeMessage(2,Ar,k);var O=k.keys;for(M=0;M<O.length;M++)I.writeStringField(3,O[M]);var N=k.values;for(M=0;M<N.length;M++)I.writeMessage(4,jr,N[M])}function Ar(R,I){var M=R.feature;M.id!==void 0&&I.writeVarintField(1,M.id),I.writeMessage(2,ti,R),I.writeVarintField(3,M.type),I.writeMessage(4,ki,M)}function ti(R,I){var M=R.feature,k=R.keys,O=R.values,N=R.keycache,K=R.valuecache;for(var Z in M.properties){var j=M.properties[Z],W=N[Z];if(j!==null){W===void 0&&(k.push(Z),N[Z]=W=k.length-1),I.writeVarint(W);var se=typeof j;se!=="string"&&se!=="boolean"&&se!=="number"&&(j=JSON.stringify(j));var ae=se+":"+j,le=K[ae];le===void 0&&(O.push(j),K[ae]=le=O.length-1),I.writeVarint(le)}}}function vi(R,I){return(I<<3)+(7&R)}function hr(R){return R<<1^R>>31}function ki(R,I){for(var M=R.loadGeometry(),k=R.type,O=0,N=0,K=M.length,Z=0;Z<K;Z++){var j=M[Z],W=1;k===1&&(W=j.length),I.writeVarint(vi(1,W));for(var se=k===3?j.length-1:j.length,ae=0;ae<se;ae++){ae===1&&k!==1&&I.writeVarint(vi(2,se-1));var le=j[ae].x-O,Pe=j[ae].y-N;I.writeVarint(hr(le)),I.writeVarint(hr(Pe)),O+=le,N+=Pe}k===3&&I.writeVarint(vi(7,1))}}function jr(R,I){var M=typeof R;M==="string"?I.writeStringField(1,R):M==="boolean"?I.writeBooleanField(7,R):M==="number"&&(R%1!=0?I.writeDoubleField(3,R):R<0?I.writeSVarintField(6,R):I.writeVarintField(5,R))}Ir.exports=fs,Ir.exports.fromVectorTileJs=fs,Ir.exports.fromGeojsonVt=function(R,I){I=I||{};var M={};for(var k in R)M[k]=new mt(R[k].features,I),M[k].name=k,M[k].version=I.version,M[k].extent=I.extent;return fs({layers:M})},Ir.exports.GeoJSONWrapper=mt;var qs=c.bz(Ir.exports);const _a={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:R=>R},Zs=Math.fround||(Yi=new Float32Array(1),R=>(Yi[0]=+R,Yi[0]));var Yi;const ct=3,hi=5,qr=6;class ms{constructor(I){this.options=Object.assign(Object.create(_a),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:M,minZoom:k,maxZoom:O}=this.options;M&&console.time("total time");const N=`prepare ${I.length} points`;M&&console.time(N),this.points=I;const K=[];for(let j=0;j<I.length;j++){const W=I[j];if(!W.geometry)continue;const[se,ae]=W.geometry.coordinates,le=Zs(ji(se)),Pe=Zs(zi(ae));K.push(le,Pe,1/0,j,-1,1),this.options.reduce&&K.push(0)}let Z=this.trees[O+1]=this._createTree(K);M&&console.timeEnd(N);for(let j=O;j>=k;j--){const W=+Date.now();Z=this.trees[j]=this._createTree(this._cluster(Z,j)),M&&console.log("z%d: %d clusters in %dms",j,Z.numItems,+Date.now()-W)}return M&&console.timeEnd("total time"),this}getClusters(I,M){let k=((I[0]+180)%360+360)%360-180;const O=Math.max(-90,Math.min(90,I[1]));let N=I[2]===180?180:((I[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)k=-180,N=180;else if(k>N){const ae=this.getClusters([k,O,180,K],M),le=this.getClusters([-180,O,N,K],M);return ae.concat(le)}const Z=this.trees[this._limitZoom(M)],j=Z.range(ji(k),zi(K),ji(N),zi(O)),W=Z.data,se=[];for(const ae of j){const le=this.stride*ae;se.push(W[le+hi]>1?gs(W,le,this.clusterProps):this.points[W[le+ct]])}return se}getChildren(I){const M=this._getOriginId(I),k=this._getOriginZoom(I),O="No cluster with the specified id.",N=this.trees[k];if(!N)throw new Error(O);const K=N.data;if(M*this.stride>=K.length)throw new Error(O);const Z=this.options.radius/(this.options.extent*Math.pow(2,k-1)),j=N.within(K[M*this.stride],K[M*this.stride+1],Z),W=[];for(const se of j){const ae=se*this.stride;K[ae+4]===I&&W.push(K[ae+hi]>1?gs(K,ae,this.clusterProps):this.points[K[ae+ct]])}if(W.length===0)throw new Error(O);return W}getLeaves(I,M,k){const O=[];return this._appendLeaves(O,I,M=M||10,k=k||0,0),O}getTile(I,M,k){const O=this.trees[this._limitZoom(I)],N=Math.pow(2,I),{extent:K,radius:Z}=this.options,j=Z/K,W=(k-j)/N,se=(k+1+j)/N,ae={features:[]};return this._addTileFeatures(O.range((M-j)/N,W,(M+1+j)/N,se),O.data,M,k,N,ae),M===0&&this._addTileFeatures(O.range(1-j/N,W,1,se),O.data,N,k,N,ae),M===N-1&&this._addTileFeatures(O.range(0,W,j/N,se),O.data,-1,k,N,ae),ae.features.length?ae:null}getClusterExpansionZoom(I){let M=this._getOriginZoom(I)-1;for(;M<=this.options.maxZoom;){const k=this.getChildren(I);if(M++,k.length!==1)break;I=k[0].properties.cluster_id}return M}_appendLeaves(I,M,k,O,N){const K=this.getChildren(M);for(const Z of K){const j=Z.properties;if(j&&j.cluster?N+j.point_count<=O?N+=j.point_count:N=this._appendLeaves(I,j.cluster_id,k,O,N):N<O?N++:I.push(Z),I.length===k)break}return N}_createTree(I){const M=new c.av(I.length/this.stride|0,this.options.nodeSize,Float32Array);for(let k=0;k<I.length;k+=this.stride)M.add(I[k],I[k+1]);return M.finish(),M.data=I,M}_addTileFeatures(I,M,k,O,N,K){for(const Z of I){const j=Z*this.stride,W=M[j+hi]>1;let se,ae,le;if(W)se=Mr(M,j,this.clusterProps),ae=M[j],le=M[j+1];else{const Te=this.points[M[j+ct]];se=Te.properties;const[ze,Oe]=Te.geometry.coordinates;ae=ji(ze),le=zi(Oe)}const Pe={type:1,geometry:[[Math.round(this.options.extent*(ae*N-k)),Math.round(this.options.extent*(le*N-O))]],tags:se};let Re;Re=W||this.options.generateId?M[j+ct]:this.points[M[j+ct]].id,Re!==void 0&&(Pe.id=Re),K.features.push(Pe)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,M){const{radius:k,extent:O,reduce:N,minPoints:K}=this.options,Z=k/(O*Math.pow(2,M)),j=I.data,W=[],se=this.stride;for(let ae=0;ae<j.length;ae+=se){if(j[ae+2]<=M)continue;j[ae+2]=M;const le=j[ae],Pe=j[ae+1],Re=I.within(j[ae],j[ae+1],Z),Te=j[ae+hi];let ze=Te;for(const Oe of Re){const tt=Oe*se;j[tt+2]>M&&(ze+=j[tt+hi])}if(ze>Te&&ze>=K){let Oe,tt=le*Te,st=Pe*Te,Ke=-1;const He=((ae/se|0)<<5)+(M+1)+this.points.length;for(const Wt of Re){const ot=Wt*se;if(j[ot+2]<=M)continue;j[ot+2]=M;const kt=j[ot+hi];tt+=j[ot]*kt,st+=j[ot+1]*kt,j[ot+4]=He,N&&(Oe||(Oe=this._map(j,ae,!0),Ke=this.clusterProps.length,this.clusterProps.push(Oe)),N(Oe,this._map(j,ot)))}j[ae+4]=He,W.push(tt/ze,st/ze,1/0,He,-1,ze),N&&W.push(Ke)}else{for(let Oe=0;Oe<se;Oe++)W.push(j[ae+Oe]);if(ze>1)for(const Oe of Re){const tt=Oe*se;if(!(j[tt+2]<=M)){j[tt+2]=M;for(let st=0;st<se;st++)W.push(j[tt+st])}}}}return W}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,M,k){if(I[M+hi]>1){const K=this.clusterProps[I[M+qr]];return k?Object.assign({},K):K}const O=this.points[I[M+ct]].properties,N=this.options.map(O);return k&&N===O?Object.assign({},N):N}}function gs(R,I,M){return{type:"Feature",id:R[I+ct],properties:Mr(R,I,M),geometry:{type:"Point",coordinates:[(k=R[I],360*(k-.5)),Gs(R[I+1])]}};var k}function Mr(R,I,M){const k=R[I+hi],O=k>=1e4?`${Math.round(k/1e3)}k`:k>=1e3?Math.round(k/100)/10+"k":k,N=R[I+qr],K=N===-1?{}:Object.assign({},M[N]);return Object.assign(K,{cluster:!0,cluster_id:R[I+ct],point_count:k,point_count_abbreviated:O})}function ji(R){return R/360+.5}function zi(R){const I=Math.sin(R*Math.PI/180),M=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return M<0?0:M>1?1:M}function Gs(R){const I=(180-360*R)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Er(R,I,M,k){for(var O,N=k,K=M-I>>1,Z=M-I,j=R[I],W=R[I+1],se=R[M],ae=R[M+1],le=I+3;le<M;le+=3){var Pe=Xs(R[le],R[le+1],j,W,se,ae);if(Pe>N)O=le,N=Pe;else if(Pe===N){var Re=Math.abs(le-K);Re<Z&&(O=le,Z=Re)}}N>k&&(O-I>3&&Er(R,I,O,k),R[O+2]=N,M-O>3&&Er(R,O,M,k))}function Xs(R,I,M,k,O,N){var K=O-M,Z=N-k;if(K!==0||Z!==0){var j=((R-M)*K+(I-k)*Z)/(K*K+Z*Z);j>1?(M=O,k=N):j>0&&(M+=K*j,k+=Z*j)}return(K=R-M)*K+(Z=I-k)*Z}function ur(R,I,M,k){var O={id:R===void 0?null:R,type:I,geometry:M,tags:k,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(N){var K=N.geometry,Z=N.type;if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")_s(N,K);else if(Z==="Polygon"||Z==="MultiLineString")for(var j=0;j<K.length;j++)_s(N,K[j]);else if(Z==="MultiPolygon")for(j=0;j<K.length;j++)for(var W=0;W<K[j].length;W++)_s(N,K[j][W])}(O),O}function _s(R,I){for(var M=0;M<I.length;M+=3)R.minX=Math.min(R.minX,I[M]),R.minY=Math.min(R.minY,I[M+1]),R.maxX=Math.max(R.maxX,I[M]),R.maxY=Math.max(R.maxY,I[M+1])}function Zr(R,I,M,k){if(I.geometry){var O=I.geometry.coordinates,N=I.geometry.type,K=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2),Z=[],j=I.id;if(M.promoteId?j=I.properties[M.promoteId]:M.generateId&&(j=k||0),N==="Point")Cr(O,Z);else if(N==="MultiPoint")for(var W=0;W<O.length;W++)Cr(O[W],Z);else if(N==="LineString")Pr(O,Z,K,!1);else if(N==="MultiLineString"){if(M.lineMetrics){for(W=0;W<O.length;W++)Pr(O[W],Z=[],K,!1),R.push(ur(j,"LineString",Z,I.properties));return}Gr(O,Z,K,!1)}else if(N==="Polygon")Gr(O,Z,K,!0);else{if(N!=="MultiPolygon"){if(N==="GeometryCollection"){for(W=0;W<I.geometry.geometries.length;W++)Zr(R,{id:j,geometry:I.geometry.geometries[W],properties:I.properties},M,k);return}throw new Error("Input data is not a valid GeoJSON object.")}for(W=0;W<O.length;W++){var se=[];Gr(O[W],se,K,!0),Z.push(se)}}R.push(ur(j,N,Z,I.properties))}}function Cr(R,I){I.push(re(R[0])),I.push(ui(R[1])),I.push(0)}function Pr(R,I,M,k){for(var O,N,K=0,Z=0;Z<R.length;Z++){var j=re(R[Z][0]),W=ui(R[Z][1]);I.push(j),I.push(W),I.push(0),Z>0&&(K+=k?(O*W-j*N)/2:Math.sqrt(Math.pow(j-O,2)+Math.pow(W-N,2))),O=j,N=W}var se=I.length-3;I[2]=1,Er(I,0,se,M),I[se+2]=1,I.size=Math.abs(K),I.start=0,I.end=I.size}function Gr(R,I,M,k){for(var O=0;O<R.length;O++){var N=[];Pr(R[O],N,M,k),I.push(N)}}function re(R){return R/360+.5}function ui(R){var I=Math.sin(R*Math.PI/180),M=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return M<0?0:M>1?1:M}function Di(R,I,M,k,O,N,K,Z){if(k/=I,N>=(M/=I)&&K<k)return R;if(K<M||N>=k)return null;for(var j=[],W=0;W<R.length;W++){var se=R[W],ae=se.geometry,le=se.type,Pe=O===0?se.minX:se.minY,Re=O===0?se.maxX:se.maxY;if(Pe>=M&&Re<k)j.push(se);else if(!(Re<M||Pe>=k)){var Te=[];if(le==="Point"||le==="MultiPoint")nt(ae,Te,M,k,O);else if(le==="LineString")Ye(ae,Te,M,k,O,!1,Z.lineMetrics);else if(le==="MultiLineString")ys(ae,Te,M,k,O,!1);else if(le==="Polygon")ys(ae,Te,M,k,O,!0);else if(le==="MultiPolygon")for(var ze=0;ze<ae.length;ze++){var Oe=[];ys(ae[ze],Oe,M,k,O,!0),Oe.length&&Te.push(Oe)}if(Te.length){if(Z.lineMetrics&&le==="LineString"){for(ze=0;ze<Te.length;ze++)j.push(ur(se.id,le,Te[ze],se.tags));continue}le!=="LineString"&&le!=="MultiLineString"||(Te.length===1?(le="LineString",Te=Te[0]):le="MultiLineString"),le!=="Point"&&le!=="MultiPoint"||(le=Te.length===3?"Point":"MultiPoint"),j.push(ur(se.id,le,Te,se.tags))}}}return j.length?j:null}function nt(R,I,M,k,O){for(var N=0;N<R.length;N+=3){var K=R[N+O];K>=M&&K<=k&&(I.push(R[N]),I.push(R[N+1]),I.push(R[N+2]))}}function Ye(R,I,M,k,O,N,K){for(var Z,j,W=Ji(R),se=O===0?ya:xs,ae=R.start,le=0;le<R.length-3;le+=3){var Pe=R[le],Re=R[le+1],Te=R[le+2],ze=R[le+3],Oe=R[le+4],tt=O===0?Pe:Re,st=O===0?ze:Oe,Ke=!1;K&&(Z=Math.sqrt(Math.pow(Pe-ze,2)+Math.pow(Re-Oe,2))),tt<M?st>M&&(j=se(W,Pe,Re,ze,Oe,M),K&&(W.start=ae+Z*j)):tt>k?st<k&&(j=se(W,Pe,Re,ze,Oe,k),K&&(W.start=ae+Z*j)):pr(W,Pe,Re,Te),st<M&&tt>=M&&(j=se(W,Pe,Re,ze,Oe,M),Ke=!0),st>k&&tt<=k&&(j=se(W,Pe,Re,ze,Oe,k),Ke=!0),!N&&Ke&&(K&&(W.end=ae+Z*j),I.push(W),W=Ji(R)),K&&(ae+=Z)}var He=R.length-3;Pe=R[He],Re=R[He+1],Te=R[He+2],(tt=O===0?Pe:Re)>=M&&tt<=k&&pr(W,Pe,Re,Te),He=W.length-3,N&&He>=3&&(W[He]!==W[0]||W[He+1]!==W[1])&&pr(W,W[0],W[1],W[2]),W.length&&I.push(W)}function Ji(R){var I=[];return I.size=R.size,I.start=R.start,I.end=R.end,I}function ys(R,I,M,k,O,N){for(var K=0;K<R.length;K++)Ye(R[K],I,M,k,O,N,!1)}function pr(R,I,M,k){R.push(I),R.push(M),R.push(k)}function ya(R,I,M,k,O,N){var K=(N-I)/(k-I);return R.push(N),R.push(M+(O-M)*K),R.push(1),K}function xs(R,I,M,k,O,N){var K=(N-M)/(O-M);return R.push(I+(k-I)*K),R.push(N),R.push(1),K}function kr(R,I){for(var M=[],k=0;k<R.length;k++){var O,N=R[k],K=N.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")O=Xr(N.geometry,I);else if(K==="MultiLineString"||K==="Polygon"){O=[];for(var Z=0;Z<N.geometry.length;Z++)O.push(Xr(N.geometry[Z],I))}else if(K==="MultiPolygon")for(O=[],Z=0;Z<N.geometry.length;Z++){for(var j=[],W=0;W<N.geometry[Z].length;W++)j.push(Xr(N.geometry[Z][W],I));O.push(j)}M.push(ur(N.id,K,O,N.tags))}return M}function Xr(R,I){var M=[];M.size=R.size,R.start!==void 0&&(M.start=R.start,M.end=R.end);for(var k=0;k<R.length;k+=3)M.push(R[k]+I,R[k+1],R[k+2]);return M}function fe(R,I){if(R.transformed)return R;var M,k,O,N=1<<R.z,K=R.x,Z=R.y;for(M=0;M<R.features.length;M++){var j=R.features[M],W=j.geometry,se=j.type;if(j.geometry=[],se===1)for(k=0;k<W.length;k+=2)j.geometry.push(Qi(W[k],W[k+1],I,N,K,Z));else for(k=0;k<W.length;k++){var ae=[];for(O=0;O<W[k].length;O+=2)ae.push(Qi(W[k][O],W[k][O+1],I,N,K,Z));j.geometry.push(ae)}}return R.transformed=!0,R}function Qi(R,I,M,k,O,N){return[Math.round(M*(R*k-O)),Math.round(M*(I*k-N))]}function vt(R,I,M,k,O){for(var N=I===O.maxZoom?0:O.tolerance/((1<<I)*O.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:M,y:k,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Z=0;Z<R.length;Z++){K.numFeatures++,Wr(K,R[Z],N,O);var j=R[Z].minX,W=R[Z].minY,se=R[Z].maxX,ae=R[Z].maxY;j<K.minX&&(K.minX=j),W<K.minY&&(K.minY=W),se>K.maxX&&(K.maxX=se),ae>K.maxY&&(K.maxY=ae)}return K}function Wr(R,I,M,k){var O=I.geometry,N=I.type,K=[];if(N==="Point"||N==="MultiPoint")for(var Z=0;Z<O.length;Z+=3)K.push(O[Z]),K.push(O[Z+1]),R.numPoints++,R.numSimplified++;else if(N==="LineString")dr(K,O,R,M,!1,!1);else if(N==="MultiLineString"||N==="Polygon")for(Z=0;Z<O.length;Z++)dr(K,O[Z],R,M,N==="Polygon",Z===0);else if(N==="MultiPolygon")for(var j=0;j<O.length;j++){var W=O[j];for(Z=0;Z<W.length;Z++)dr(K,W[Z],R,M,!0,Z===0)}if(K.length){var se=I.tags||null;if(N==="LineString"&&k.lineMetrics){for(var ae in se={},I.tags)se[ae]=I.tags[ae];se.mapbox_clip_start=O.start/O.size,se.mapbox_clip_end=O.end/O.size}var le={geometry:K,type:N==="Polygon"||N==="MultiPolygon"?3:N==="LineString"||N==="MultiLineString"?2:1,tags:se};I.id!==null&&(le.id=I.id),R.features.push(le)}}function dr(R,I,M,k,O,N){var K=k*k;if(k>0&&I.size<(O?K:k))M.numPoints+=I.length/3;else{for(var Z=[],j=0;j<I.length;j+=3)(k===0||I[j+2]>K)&&(M.numSimplified++,Z.push(I[j]),Z.push(I[j+1])),M.numPoints++;O&&function(W,se){for(var ae=0,le=0,Pe=W.length,Re=Pe-2;le<Pe;Re=le,le+=2)ae+=(W[le]-W[Re])*(W[le+1]+W[Re+1]);if(ae>0===se)for(le=0,Pe=W.length;le<Pe/2;le+=2){var Te=W[le],ze=W[le+1];W[le]=W[Pe-2-le],W[le+1]=W[Pe-1-le],W[Pe-2-le]=Te,W[Pe-1-le]=ze}}(Z,N),R.push(Z)}}function ge(R,I){var M=(I=this.options=function(O,N){for(var K in N)O[K]=N[K];return O}(Object.create(this.options),I)).debug;if(M&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var k=function(O,N){var K=[];if(O.type==="FeatureCollection")for(var Z=0;Z<O.features.length;Z++)Zr(K,O.features[Z],N,Z);else Zr(K,O.type==="Feature"?O:{geometry:O},N);return K}(R,I);this.tiles={},this.tileCoords=[],M&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),k=function(O,N){var K=N.buffer/N.extent,Z=O,j=Di(O,1,-1-K,K,0,-1,2,N),W=Di(O,1,1-K,2+K,0,-1,2,N);return(j||W)&&(Z=Di(O,1,-K,1+K,0,-1,2,N)||[],j&&(Z=kr(j,1).concat(Z)),W&&(Z=Z.concat(kr(W,-1)))),Z}(k,I),k.length&&this.splitTile(k,0,0,0),M&&(k.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)))}function Ue(R,I,M){return 32*((1<<R)*M+I)+R}function Fe(R,I){return I?R.properties[I]:R.id}function ii(R,I){if(R==null)return!0;if(R.type==="Feature")return Fe(R,I)!=null;if(R.type==="FeatureCollection"){const M=new Set;for(const k of R.features){const O=Fe(k,I);if(O==null||M.has(O))return!1;M.add(O)}return!0}return!1}function er(R,I){const M=new Map;if(R!=null)if(R.type==="Feature")M.set(Fe(R,I),R);else for(const k of R.features)M.set(Fe(k,I),k);return M}ge.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ge.prototype.splitTile=function(R,I,M,k,O,N,K){for(var Z=[R,I,M,k],j=this.options,W=j.debug;Z.length;){k=Z.pop(),M=Z.pop(),I=Z.pop(),R=Z.pop();var se=1<<I,ae=Ue(I,M,k),le=this.tiles[ae];if(!le&&(W>1&&console.time("creation"),le=this.tiles[ae]=vt(R,I,M,k,j),this.tileCoords.push({z:I,x:M,y:k}),W)){W>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,M,k,le.numFeatures,le.numPoints,le.numSimplified),console.timeEnd("creation"));var Pe="z"+I;this.stats[Pe]=(this.stats[Pe]||0)+1,this.total++}if(le.source=R,O){if(I===j.maxZoom||I===O)continue;var Re=1<<O-I;if(M!==Math.floor(N/Re)||k!==Math.floor(K/Re))continue}else if(I===j.indexMaxZoom||le.numPoints<=j.indexMaxPoints)continue;if(le.source=null,R.length!==0){W>1&&console.time("clipping");var Te,ze,Oe,tt,st,Ke,He=.5*j.buffer/j.extent,Wt=.5-He,ot=.5+He,kt=1+He;Te=ze=Oe=tt=null,st=Di(R,se,M-He,M+ot,0,le.minX,le.maxX,j),Ke=Di(R,se,M+Wt,M+kt,0,le.minX,le.maxX,j),R=null,st&&(Te=Di(st,se,k-He,k+ot,1,le.minY,le.maxY,j),ze=Di(st,se,k+Wt,k+kt,1,le.minY,le.maxY,j),st=null),Ke&&(Oe=Di(Ke,se,k-He,k+ot,1,le.minY,le.maxY,j),tt=Di(Ke,se,k+Wt,k+kt,1,le.minY,le.maxY,j),Ke=null),W>1&&console.timeEnd("clipping"),Z.push(Te||[],I+1,2*M,2*k),Z.push(ze||[],I+1,2*M,2*k+1),Z.push(Oe||[],I+1,2*M+1,2*k),Z.push(tt||[],I+1,2*M+1,2*k+1)}}},ge.prototype.getTile=function(R,I,M){var k=this.options,O=k.extent,N=k.debug;if(R<0||R>24)return null;var K=1<<R,Z=Ue(R,I=(I%K+K)%K,M);if(this.tiles[Z])return fe(this.tiles[Z],O);N>1&&console.log("drilling down to z%d-%d-%d",R,I,M);for(var j,W=R,se=I,ae=M;!j&&W>0;)W--,se=Math.floor(se/2),ae=Math.floor(ae/2),j=this.tiles[Ue(W,se,ae)];return j&&j.source?(N>1&&console.log("found parent tile z%d-%d-%d",W,se,ae),N>1&&console.time("drilling down"),this.splitTile(j.source,W,se,ae,R,I,M),N>1&&console.timeEnd("drilling down"),this.tiles[Z]?fe(this.tiles[Z],O):null):null};class Ve extends us{constructor(I,M,k,O){super(I,M,k),this._dataUpdateable=new Map,this.loadGeoJSON=(N,K)=>{const{promoteId:Z}=N;if(N.request)return c.f(N.request,(j,W,se,ae)=>{this._dataUpdateable=ii(W,Z)?er(W,Z):void 0,K(j,W,se,ae)});if(typeof N.data=="string")try{const j=JSON.parse(N.data);this._dataUpdateable=ii(j,Z)?er(j,Z):void 0,K(null,j)}catch{K(new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`))}else N.dataDiff?this._dataUpdateable?(function(j,W,se){var ae,le,Pe,Re;if(W.removeAll&&j.clear(),W.remove)for(const Te of W.remove)j.delete(Te);if(W.add)for(const Te of W.add){const ze=Fe(Te,se);ze!=null&&j.set(ze,Te)}if(W.update)for(const Te of W.update){let ze=j.get(Te.id);if(ze==null)continue;const Oe=!Te.removeAllProperties&&(((ae=Te.removeProperties)===null||ae===void 0?void 0:ae.length)>0||((le=Te.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0);if((Te.newGeometry||Te.removeAllProperties||Oe)&&(ze=Object.assign({},ze),j.set(Te.id,ze),Oe&&(ze.properties=Object.assign({},ze.properties))),Te.newGeometry&&(ze.geometry=Te.newGeometry),Te.removeAllProperties)ze.properties={};else if(((Pe=Te.removeProperties)===null||Pe===void 0?void 0:Pe.length)>0)for(const tt of Te.removeProperties)Object.prototype.hasOwnProperty.call(ze.properties,tt)&&delete ze.properties[tt];if(((Re=Te.addOrUpdateProperties)===null||Re===void 0?void 0:Re.length)>0)for(const{key:tt,value:st}of Te.addOrUpdateProperties)ze.properties[tt]=st}}(this._dataUpdateable,N.dataDiff,Z),K(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):K(new Error(`Cannot update existing geojson data in ${N.source}`)):K(new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,O&&(this.loadGeoJSON=O)}loadGeoJSONTile(I,M){const k=I.tileID.canonical;if(!this._geoJSONIndex)return M(null,null);const O=this._geoJSONIndex.getTile(k.z,k.x,k.y);if(!O)return M(null,null);const N=new class{constructor(Z){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.N,this.length=Z.length,this._features=Z}feature(Z){return new class{constructor(j){this._feature=j,this.extent=c.N,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const W of this._feature.geometry)j.push([new c.P(W[0],W[1])]);return j}{const j=[];for(const W of this._feature.geometry){const se=[];for(const ae of W)se.push(new c.P(ae[0],ae[1]));j.push(se)}return j}}toGeoJSON(j,W,se){return ma.call(this,j,W,se)}}(this._features[Z])}}(O.features);let K=qs(N);K.byteOffset===0&&K.byteLength===K.buffer.byteLength||(K=new Uint8Array(K)),M(null,{vectorTile:N,rawData:K.buffer})}loadData(I,M){var k;(k=this._pendingRequest)===null||k===void 0||k.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const O=!!(I&&I.request&&I.request.collectResourceTiming)&&new c.bu(I.request);this._pendingCallback=M,this._pendingRequest=this.loadGeoJSON(I,(N,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,N||!K)return M(N);if(typeof K!="object")return M(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{Pt(K,!0);try{if(I.filter){const j=c.bC(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(j.result==="error")throw new Error(j.value.map(se=>`${se.key}: ${se.message}`).join(", "));K={type:"FeatureCollection",features:K.features.filter(se=>j.value.evaluate({zoom:0},se))}}this._geoJSONIndex=I.cluster?new ms(function({superclusterOptions:j,clusterProperties:W}){if(!W||!j)return j;const se={},ae={},le={accumulated:null,zoom:0},Pe={properties:null},Re=Object.keys(W);for(const Te of Re){const[ze,Oe]=W[Te],tt=c.bC(Oe),st=c.bC(typeof ze=="string"?[ze,["accumulated"],["get",Te]]:ze);se[Te]=tt.value,ae[Te]=st.value}return j.map=Te=>{Pe.properties=Te;const ze={};for(const Oe of Re)ze[Oe]=se[Oe].evaluate(le,Pe);return ze},j.reduce=(Te,ze)=>{Pe.properties=ze;for(const Oe of Re)le.accumulated=Te[Oe],Te[Oe]=ae[Oe].evaluate(le,Pe)},j}(I)).load(K.features):function(j,W){return new ge(j,W)}(K,I.geojsonVtOptions)}catch(j){return M(j)}this.loaded={};const Z={};if(O){const j=O.finish();j&&(Z.resourceTiming={},Z.resourceTiming[I.source]=JSON.parse(JSON.stringify(j)))}M(null,Z)}})}reloadTile(I,M){const k=this.loaded;return k&&k[I.uid]?super.reloadTile(I,M):this.loadTile(I,M)}removeSource(I,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(I,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(k){M(k)}}getClusterChildren(I,M){try{M(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(k){M(k)}}getClusterLeaves(I,M){try{M(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(k){M(k)}}}class fr{constructor(I){this.self=I,this.actor=new c.C(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:us,geojson:Ve},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,k)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=k},this.self.registerRTLTextPlugin=M=>{if(c.bD.isParsed())throw new Error("RTL text plugin already registered.");c.bD.applyArabicShaping=M.applyArabicShaping,c.bD.processBidirectionalText=M.processBidirectionalText,c.bD.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(I,M){this.referrer=M}setImages(I,M,k){this.availableImages[I]=M;for(const O in this.workerSources[I]){const N=this.workerSources[I][O];for(const K in N)N[K].availableImages=M}k()}setLayers(I,M,k){this.getLayerIndex(I).replace(M),k()}updateLayers(I,M,k){this.getLayerIndex(I).update(M.layers,M.removedIds),k()}loadTile(I,M,k){this.getWorkerSource(I,M.type,M.source).loadTile(M,k)}loadDEMTile(I,M,k){this.getDEMWorkerSource(I,M.source).loadTile(M,k)}reloadTile(I,M,k){this.getWorkerSource(I,M.type,M.source).reloadTile(M,k)}abortTile(I,M,k){this.getWorkerSource(I,M.type,M.source).abortTile(M,k)}removeTile(I,M,k){this.getWorkerSource(I,M.type,M.source).removeTile(M,k)}removeDEMTile(I,M){this.getDEMWorkerSource(I,M.source).removeTile(M)}removeSource(I,M,k){if(!this.workerSources[I]||!this.workerSources[I][M.type]||!this.workerSources[I][M.type][M.source])return;const O=this.workerSources[I][M.type][M.source];delete this.workerSources[I][M.type][M.source],O.removeSource!==void 0?O.removeSource(M,k):k()}loadWorkerSource(I,M,k){try{this.self.importScripts(M.url),k()}catch(O){k(O.toString())}}syncRTLPluginState(I,M,k){try{c.bD.setState(M);const O=c.bD.getPluginURL();if(c.bD.isLoaded()&&!c.bD.isParsed()&&O!=null){this.self.importScripts(O);const N=c.bD.isParsed();k(N?void 0:new Error(`RTL Text Plugin failed to import scripts from ${O}`),N)}}catch(O){k(O.toString())}}getAvailableImages(I){let M=this.availableImages[I];return M||(M=[]),M}getLayerIndex(I){let M=this.layerIndexes[I];return M||(M=this.layerIndexes[I]=new Wi),M}getWorkerSource(I,M,k){return this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][M]||(this.workerSources[I][M]={}),this.workerSources[I][M][k]||(this.workerSources[I][M][k]=new this.workerSourceTypes[M]({send:(O,N,K)=>{this.actor.send(O,N,K,I)}},this.getLayerIndex(I),this.getAvailableImages(I))),this.workerSources[I][M][k]}getDEMWorkerSource(I,M){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][M]||(this.demWorkerSources[I][M]=new Us),this.demWorkerSources[I][M]}}return c.i()&&(self.worker=new fr(self)),fr}),Ns(["./shared"],function(c){var Wi="3.6.2";class ie{static testProp(t){if(!ie.docStyle)return t[0];for(let s=0;s<t.length;s++)if(t[s]in ie.docStyle)return t[s];return t[0]}static create(t,s,n){const l=window.document.createElement(t);return s!==void 0&&(l.className=s),n&&n.appendChild(l),l}static createNS(t,s){return window.document.createElementNS(t,s)}static disableDrag(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(t,s){t.style[ie.transformProp]=s}static addEventListener(t,s,n,l={}){t.addEventListener(s,n,"passive"in l?l:l.capture)}static removeEventListener(t,s,n,l={}){t.removeEventListener(s,n,"passive"in l?l:l.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)},0)}static mousePos(t,s){const n=t.getBoundingClientRect();return new c.P(s.clientX-n.left-t.clientLeft,s.clientY-n.top-t.clientTop)}static touchPos(t,s){const n=t.getBoundingClientRect(),l=[];for(let p=0;p<s.length;p++)l.push(new c.P(s[p].clientX-n.left-t.clientLeft,s[p].clientY-n.top-t.clientTop));return l}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ie.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);const Hi={supported:!1,testSupport:function(h){!us&&Be&&(Us?ps(h):ci=h)}};let ci,Be,us=!1,Us=!1;function ps(h){const t=h.createTexture();h.bindTexture(h.TEXTURE_2D,t);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,Be),h.isContextLost())return;Hi.supported=!0}catch{}h.deleteTexture(t),us=!0}var ei,Pt;typeof document<"u"&&(Be=document.createElement("img"),Be.onload=function(){ci&&ps(ci),ci=null,Us=!0},Be.onerror=function(){us=!0,ci=null},Be.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let t,s,n,l;h.resetRequestQueue=()=>{t=[],s=0,n=0,l={}},h.addThrottleControl=v=>{const w=n++;return l[w]=v,w},h.removeThrottleControl=v=>{delete l[v],g()},h.getImage=(v,w,S=!0)=>{Hi.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*");const E={requestParameters:v,supportImageRefresh:S,callback:w,cancelled:!1,completed:!1,cancel:()=>{E.completed||E.cancelled||(E.cancelled=!0,E.innerRequest&&(E.innerRequest.cancel(),s--),g())}};return t.push(E),g(),E};const p=v=>{const{requestParameters:w,supportImageRefresh:S,callback:E}=v;return c.e(w,{type:"image"}),(S!==!1||c.i()||c.g(w.url)||w.headers&&!Object.keys(w.headers).reduce((B,L)=>B&&L==="accept",!0)?c.m:y)(w,(B,L,F,z)=>{m(v,E,B,L,F,z)})},m=(v,w,S,E,B,L)=>{S?w(S):E instanceof HTMLImageElement||c.a(E)?w(null,E):E&&((F,z)=>{typeof createImageBitmap=="function"?c.b(F,z):c.d(F,z)})(E,(F,z)=>{F!=null?w(F):z!=null&&w(null,z,{cacheControl:B,expires:L})}),v.cancelled||(v.completed=!0,s--,g())},g=()=>{const v=(()=>{const w=Object.keys(l);let S=!1;if(w.length>0){for(const E of w)if(S=l[E](),S)break}return S})()?c.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=s;w<v&&t.length>0;w++){const S=t.shift();if(S.cancelled){w--;continue}const E=p(S);s++,S.innerRequest=E}},y=(v,w)=>{const S=new Image,E=v.url;let B=!1;const L=v.credentials;return L&&L==="include"?S.crossOrigin="use-credentials":(L&&L==="same-origin"||!c.s(E))&&(S.crossOrigin="anonymous"),S.fetchPriority="high",S.onload=()=>{w(null,S),S.onerror=S.onload=null},S.onerror=()=>{B||w(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.onerror=S.onload=null},S.src=E,{cancel:()=>{B=!0,S.src=""}}}}(ei||(ei={})),ei.resetRequestQueue(),function(h){h.Glyphs="Glyphs",h.Image="Image",h.Source="Source",h.SpriteImage="SpriteImage",h.SpriteJSON="SpriteJSON",h.Style="Style",h.Tile="Tile",h.Unknown="Unknown"}(Pt||(Pt={}));class ma{constructor(t){this._transformRequestFn=t}transformRequest(t,s){return this._transformRequestFn&&this._transformRequestFn(t,s)||{url:t}}normalizeSpriteURL(t,s,n){const l=function(p){const m=p.match(Ir);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return l.path+=`${s}${n}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(l)}setTransformRequest(t){this._transformRequestFn=t}}const Ir=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function $s(h){var t=new c.A(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var ds,Ki=function(h,t,s){return h[0]=t[0]-s[0],h[1]=t[1]-s[1],h[2]=t[2]-s[2],h};ds=new c.A(3),c.A!=Float32Array&&(ds[0]=0,ds[1]=0,ds[2]=0);var js=function(h){var t=h[0],s=h[1];return t*t+s*s};function $t(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const s=[];for(const{id:n,url:l}of h){const p=`${n}${l}`;s.indexOf(p)===-1&&(s.push(p),t.push({id:n,url:l}))}}return t}function ga(h,t,s,n,l){if(n)return void h(n);if(l!==Object.values(t).length||l!==Object.values(s).length)return;const p={};for(const m in t){p[m]={};const g=c.h.getImageCanvasContext(s[m]),y=t[m];for(const v in y){const{width:w,height:S,x:E,y:B,sdf:L,pixelRatio:F,stretchX:z,stretchY:G,content:J}=y[v];p[m][v]={data:null,pixelRatio:F,sdf:L,stretchX:z,stretchY:G,content:J,spriteData:{width:w,height:S,x:E,y:B,context:g}}}}h(null,p)}(function(){var h=new c.A(2);c.A!=Float32Array&&(h[0]=0,h[1]=0)})();class mt{constructor(t,s,n,l){this.context=t,this.format=n,this.texture=t.gl.createTexture(),this.update(s,l)}update(t,s,n){const{width:l,height:p}=t,m=!(this.size&&this.size[0]===l&&this.size[1]===p||n),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(s&&s.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!s||s.premultiply!==!1)),m)this.size=[l,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.a(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,l,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:w}=n||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.a(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,w,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,w,l,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,s,n){const{context:l}=this,{gl:p}=l;p.bindTexture(p.TEXTURE_2D,this.texture),n!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,n||t),this.filter=t),s!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,s),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,s),this.wrap=s)}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}}function fs(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class $i 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(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:s,callback:n}of this.requestors)this._notify(s,n);this.requestors=[]}}getImage(t){const s=this.images[t];if(s&&!s.data&&s.spriteData){const n=s.spriteData;s.data=new c.R({width:n.width,height:n.height},n.context.getImageData(n.x,n.y,n.width,n.height).data),s.spriteData=null}return s}addImage(t,s){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,s)&&(this.images[t]=s)}_validate(t,s){let n=!0;const l=s.data||s.spriteData;return this._validateStretch(s.stretchX,l&&l.width)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchX" value`))),n=!1),this._validateStretch(s.stretchY,l&&l.height)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchY" value`))),n=!1),this._validateContent(s.content,s)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "content" value`))),n=!1),n}_validateStretch(t,s){if(!t)return!0;let n=0;for(const l of t){if(l[0]<n||l[1]<l[0]||s<l[1])return!1;n=l[1]}return!0}_validateContent(t,s){if(!t)return!0;if(t.length!==4)return!1;const n=s.spriteData,l=n&&n.width||s.data.width,p=n&&n.height||s.data.height;return!(t[0]<0||l<t[0]||t[1]<0||p<t[1]||t[2]<0||l<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,s,n=!0){const l=this.getImage(t);if(n&&(l.data.width!==s.data.width||l.data.height!==s.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${s.data.width}x${s.data.height}).`);s.version=l.version+1,this.images[t]=s,this.updatedImages[t]=!0}removeImage(t){const s=this.images[t];delete this.images[t],delete this.patterns[t],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,s){let n=!0;if(!this.isLoaded())for(const l of t)this.images[l]||(n=!1);this.isLoaded()||n?this._notify(t,s):this.requestors.push({ids:t,callback:s})}_notify(t,s){const n={};for(const l of t){let p=this.getImage(l);p||(this.fire(new c.k("styleimagemissing",{id:l})),p=this.getImage(l)),p?n[l]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:c.w(`Image "${l}" 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.`)}s(null,n)}getPixelSize(){const{width:t,height:s}=this.atlasImage;return{width:t,height:s}}getPattern(t){const s=this.patterns[t],n=this.getImage(t);if(!n)return null;if(s&&s.position.version===n.version)return s.position;if(s)s.position.version=n.version;else{const l={w:n.data.width+2,h:n.data.height+2,x:0,y:0},p=new c.I(l,n);this.patterns[t]={bin:l,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const s=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new mt(t,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:s,h:n}=c.p(t),l=this.atlasImage;l.resize({width:s||1,height:n||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],g=m.x+1,y=m.y+1,v=this.getImage(p).data,w=v.width,S=v.height;c.R.copy(v,l,{x:0,y:0},{x:g,y},{width:w,height:S}),c.R.copy(v,l,{x:0,y:S-1},{x:g,y:y-1},{width:w,height:1}),c.R.copy(v,l,{x:0,y:0},{x:g,y:y+S},{width:w,height:1}),c.R.copy(v,l,{x:w-1,y:0},{x:g-1,y},{width:1,height:S}),c.R.copy(v,l,{x:0,y:0},{x:g+w,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const s of t){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const n=this.getImage(s);n||c.w(`Image with ID: "${s}" was not found`),fs(n)&&this.updateImage(s,n)}}}const Ar=1e20;function ti(h,t,s,n,l,p,m,g,y){for(let v=t;v<t+n;v++)vi(h,s*p+v,p,l,m,g,y);for(let v=s;v<s+l;v++)vi(h,v*p+t,1,n,m,g,y)}function vi(h,t,s,n,l,p,m){p[0]=0,m[0]=-Ar,m[1]=Ar,l[0]=h[t];for(let g=1,y=0,v=0;g<n;g++){l[g]=h[t+g*s];const w=g*g;do{const S=p[y];v=(l[g]-l[S]+w-S*S)/(g-S)/2}while(v<=m[y]&&--y>-1);y++,p[y]=g,m[y]=v,m[y+1]=Ar}for(let g=0,y=0;g<n;g++){for(;m[y+1]<g;)y++;const v=p[y],w=g-v;h[t+g*s]=l[v]+w*w}}class hr{constructor(t,s){this.requestManager=t,this.localIdeographFontFamily=s,this.entries={}}setURL(t){this.url=t}getGlyphs(t,s){const n=[];for(const l in t)for(const p of t[l])n.push({stack:l,id:p});c.o(n,({stack:l,id:p},m)=>{let g=this.entries[l];g||(g=this.entries[l]={glyphs:{},requests:{},ranges:{}});let y=g.glyphs[p];if(y!==void 0)return void m(null,{stack:l,id:p,glyph:y});if(y=this._tinySDF(g,l,p),y)return g.glyphs[p]=y,void m(null,{stack:l,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(g.ranges[v])return void m(null,{stack:l,id:p,glyph:y});if(!this.url)return void m(new Error("glyphsUrl is not set"));let w=g.requests[v];w||(w=g.requests[v]=[],hr.loadGlyphRange(l,v,this.url,this.requestManager,(S,E)=>{if(E){for(const B in E)this._doesCharSupportLocalGlyph(+B)||(g.glyphs[+B]=E[+B]);g.ranges[v]=!0}for(const B of w)B(S,E);delete g.requests[v]})),w.push((S,E)=>{S?m(S):E&&m(null,{stack:l,id:p,glyph:E[p]||null})})},(l,p)=>{if(l)s(l);else if(p){const m={};for(const{stack:g,id:y,glyph:v}of p)(m[g]||(m[g]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};s(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](t)||c.u["Hangul Syllables"](t)||c.u.Hiragana(t)||c.u.Katakana(t))}_tinySDF(t,s,n){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(n))return;let p=t.tinySDF;if(!p){let g="400";/bold/i.test(s)?g="900":/medium/i.test(s)?g="500":/light/i.test(s)&&(g="200"),p=t.tinySDF=new hr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:g})}const m=p.draw(String.fromCharCode(n));return{id:n,bitmap:new c.q({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}hr.loadGlyphRange=function(h,t,s,n,l){const p=256*t,m=p+255,g=n.transformRequest(s.replace("{fontstack}",h).replace("{range}",`${p}-${m}`),Pt.Glyphs);c.l(g,(y,v)=>{if(y)l(y);else if(v){const w={};for(const S of c.n(v))w[S.id]=S;l(null,w)}})},hr.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:s=8,cutoff:n=.25,fontFamily:l="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=s;const g=this.size=h+4*t,y=this._createCanvas(g),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${p} ${h}px ${l}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:s,actualBoundingBoxDescent:n,actualBoundingBoxLeft:l,actualBoundingBoxRight:p}=this.ctx.measureText(h),m=Math.ceil(s),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-l))),y=Math.min(this.size-this.buffer,m+Math.ceil(n)),v=g+2*this.buffer,w=y+2*this.buffer,S=Math.max(v*w,0),E=new Uint8ClampedArray(S),B={data:E,width:v,height:w,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(g===0||y===0)return B;const{ctx:L,buffer:F,gridInner:z,gridOuter:G}=this;L.clearRect(F,F,g,y),L.fillText(h,F,F+m);const J=L.getImageData(F,F,g,y);G.fill(Ar,0,S),z.fill(0,0,S);for(let U=0;U<y;U++)for(let X=0;X<g;X++){const ee=J.data[4*(U*g+X)+3]/255;if(ee===0)continue;const te=(U+F)*v+X+F;if(ee===1)G[te]=0,z[te]=Ar;else{const ne=.5-ee;G[te]=ne>0?ne*ne:0,z[te]=ne<0?ne*ne:0}}ti(G,0,0,v,w,v,this.f,this.v,this.z),ti(z,F,F,g,y,v,this.f,this.v,this.z);for(let U=0;U<S;U++){const X=Math.sqrt(G[U])-Math.sqrt(z[U]);E[U]=Math.round(255-255*(X/this.radius+this.cutoff))}return B}};class ki{constructor(){this.specification=c.v.light.position}possiblyEvaluate(t,s){return c.z(t.expression.evaluate(s))}interpolate(t,s,n){return{x:c.B.number(t.x,s.x,n),y:c.B.number(t.y,s.y,n),z:c.B.number(t.z,s.z,n)}}}let jr;class qs extends c.E{constructor(t){super(),jr=jr||new c.r({anchor:new c.D(c.v.light.anchor),position:new ki,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(jr),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,s={}){if(!this._validate(c.t,t,s))for(const n in t){const l=t[n];n.endsWith("-transition")?this._transitionable.setTransition(n.slice(0,-11),l):this._transitionable.setValue(n,l)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,s,n){return(!n||n.validate!==!1)&&c.x(this,t.call(c.y,c.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}}class _a{constructor(t,s){this.width=t,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,s){const n=t.join(",")+String(s);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(t,s)),this.dashEntry[n]}getDashRanges(t,s,n){const l=[];let p=t.length%2==1?-t[t.length-1]*n:0,m=t[0]*n,g=!0;l.push({left:p,right:m,isDash:g,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){g=!g;const w=t[v];p=y*n,y+=w,m=y*n,l.push({left:p,right:m,isDash:g,zeroLength:w===0})}return l}addRoundDash(t,s,n){const l=s/2;for(let p=-n;p<=n;p++){const m=this.width*(this.nextRow+n+p);let g=0,y=t[g];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++g]);const w=Math.abs(v-y.left),S=Math.abs(v-y.right),E=Math.min(w,S);let B;const L=p/n*(l+1);if(y.isDash){const F=l-Math.abs(L);B=Math.sqrt(E*E+F*F)}else B=l-Math.sqrt(E*E+L*L);this.data[m+v]=Math.max(0,Math.min(255,B+128))}}}addRegularDash(t){for(let g=t.length-1;g>=0;--g){const y=t[g],v=t[g+1];y.zeroLength?t.splice(g,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(g,1))}const s=t[0],n=t[t.length-1];s.isDash===n.isDash&&(s.left=n.left-this.width,n.right=s.right+this.width);const l=this.width*this.nextRow;let p=0,m=t[p];for(let g=0;g<this.width;g++){g/m.right>1&&(m=t[++p]);const y=Math.abs(g-m.left),v=Math.abs(g-m.right),w=Math.min(y,v);this.data[l+g]=Math.max(0,Math.min(255,(m.isDash?w:-w)+128))}}addDash(t,s){const n=s?7:0,l=2*n+1;if(this.nextRow+l>this.height)return c.w("LineAtlas out of space"),null;let p=0;for(let g=0;g<t.length;g++)p+=t[g];if(p!==0){const g=this.width/p,y=this.getDashRanges(t,this.width,g);s?this.addRoundDash(y,g,n):this.addRegularDash(y)}const m={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:p};return this.nextRow+=l,this.dirty=!0,m}bind(t){const s=t.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}class Zs{constructor(t,s,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const l=this.workerPool.acquire(n);for(let p=0;p<l.length;p++){const m=new c.C(l[p],s,n);m.name=`Worker ${p}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,s,n){c.o(this.actors,(l,p)=>{l.send(t,s,p)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(s=>{s.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Yi(h,t,s){const n=function(l,p){if(l)return s(l);if(p){const m=c.F(c.e(p,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(g=>g.id)),s(null,m)}};return h.url?c.f(t.transformRequest(h.url,Pt.Source),n):c.h.frame(()=>n(null,h))}class ct{constructor(t,s){t&&(s?this.setSouthWest(t).setNorthEast(s):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof c.L?new c.L(t.lng,t.lat):c.L.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.L?new c.L(t.lng,t.lat):c.L.convert(t),this}extend(t){const s=this._sw,n=this._ne;let l,p;if(t instanceof c.L)l=t,p=t;else{if(!(t instanceof ct))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ct.convert(t)):this.extend(c.L.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.L.convert(t)):this;if(l=t._sw,p=t._ne,!l||!p)return this}return s||n?(s.lng=Math.min(l.lng,s.lng),s.lat=Math.min(l.lat,s.lat),n.lng=Math.max(p.lng,n.lng),n.lat=Math.max(p.lat,n.lat)):(this._sw=new c.L(l.lng,l.lat),this._ne=new c.L(p.lng,p.lat)),this}getCenter(){return new c.L((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.L(this.getWest(),this.getNorth())}getSouthEast(){return new c.L(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(t){const{lng:s,lat:n}=c.L.convert(t);let l=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&l}static convert(t){return t instanceof ct?t:t&&new ct(t)}static fromLngLat(t,s=0){const n=360*s/40075017,l=n/Math.cos(Math.PI/180*t.lat);return new ct(new c.L(t.lng-l,t.lat-n),new c.L(t.lng+l,t.lat+n))}}class hi{constructor(t,s,n){this.bounds=ct.convert(this.validateBounds(t)),this.minzoom=s||0,this.maxzoom=n||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const s=Math.pow(2,t.z),n=Math.floor(c.G(this.bounds.getWest())*s),l=Math.floor(c.H(this.bounds.getNorth())*s),p=Math.ceil(c.G(this.bounds.getEast())*s),m=Math.ceil(c.H(this.bounds.getSouth())*s);return t.x>=n&&t.x<p&&t.y>=l&&t.y<m}}class qr extends c.E{constructor(t,s,n,l){if(super(),this.load=()=>{this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Yi(this._options,this.map._requestManager,(p,m)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),p?this.fire(new c.j(p)):m&&(c.e(this,m),m.bounds&&(this.tileBounds=new hi(m.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>c.e({},this._options),this.id=t,this.dispatcher=n,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.F(s,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},s),this._collectResourceTiming=s.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,s){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l={request:this.map._requestManager.transformRequest(n,Pt.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,g){return delete t.request,t.aborted?s(null):m&&m.status!==404?s(m):(g&&g.resourceTiming&&(t.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&g&&t.setExpiryData(g),t.loadVectorData(g,this.map.painter),s(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=s:t.request=t.actor.send("reloadTile",l,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",l,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ms extends c.E{constructor(t,s,n,l){super(),this.id=t,this.dispatcher=n,this.setEventedParent(l),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"},s),c.e(this,c.F(s,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Yi(this._options,this.map._requestManager,(t,s)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.j(t)):s&&(c.e(this,s),s.bounds&&(this.tileBounds=new hi(s.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,s){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=ei.getImage(this.map._requestManager.transformRequest(n,Pt.Tile),(l,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",s(null);else if(l)t.state="errored",s(l);else if(p){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const g=this.map.painter.context,y=g.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new mt(g,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),t.state="loaded",s(null)}},this.map._refreshExpiredTiles)}abortTile(t,s){t.request&&(t.request.cancel(),delete t.request),s()}unloadTile(t,s){t.texture&&this.map.painter.saveTileTexture(t.texture),s()}hasTransition(){return!1}}class gs extends ms{constructor(t,s,n,l){super(t,s,n,l),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(t,s){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l=this.map._requestManager.transformRequest(n,Pt.Tile);function p(m,g){m&&(t.state="errored",s(m)),g&&(t.dem=g,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",s(null))}t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.request=ei.getImage(l,(m,g,y)=>c._(this,void 0,void 0,function*(){if(delete t.request,t.aborted)t.state="unloaded",s(null);else if(m)t.state="errored",s(m);else if(g){this.map._refreshExpiredTiles&&t.setExpiryData(y);const v=c.a(g)&&c.J()?g:yield function(S){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.K()){const E=S.width+2,B=S.height+2;try{return new c.R({width:E,height:B},yield c.M(S,-1,-1,E,B))}catch{}}return c.h.getImageData(S,1)})}(g),w={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:v,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",w,p))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(t){const s=t.canonical,n=Math.pow(2,s.z),l=(s.x-1+n)%n,p=s.x===0?t.wrap-1:t.wrap,m=(s.x+1+n)%n,g=s.x+1===n?t.wrap+1:t.wrap,y={};return y[new c.O(t.overscaledZ,p,s.z,l,s.y).key]={backfilled:!1},y[new c.O(t.overscaledZ,g,s.z,m,s.y).key]={backfilled:!1},s.y>0&&(y[new c.O(t.overscaledZ,p,s.z,l,s.y-1).key]={backfilled:!1},y[new c.O(t.overscaledZ,t.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},y[new c.O(t.overscaledZ,g,s.z,m,s.y-1).key]={backfilled:!1}),s.y+1<n&&(y[new c.O(t.overscaledZ,p,s.z,l,s.y+1).key]={backfilled:!1},y[new c.O(t.overscaledZ,t.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},y[new c.O(t.overscaledZ,g,s.z,m,s.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Mr extends c.E{constructor(t,s,n,l){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>c.e({},this._options,{type:this.type,data:this._data}),this.id=t,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=n.getActor(),this.setEventedParent(l),this._data=s.data,this._options=c.e({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId;const p=c.N/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*p,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*p,extent:c.N,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:c.N,radius:(s.clusterRadius||50)*p,log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,s){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},s),this}getClusterChildren(t,s){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},s),this}getClusterLeaves(t,s,n,l){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:s,offset:n},l),this}_updateWorkerData(t){const s=c.e({},this.workerOptions);t?s.dataDiff=t:typeof this._data=="string"?(s.request=this.map._requestManager.transformRequest(c.h.resolveURL(this._data),Pt.Source),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,s,(n,l)=>{if(this._pendingLoads--,this._removed||l&&l.abandoned)return void this.fire(new c.k("dataabort",{dataType:"source"}));let p=null;if(l&&l.resourceTiming&&l.resourceTiming[this.id]&&(p=l.resourceTiming[this.id].slice(0)),n)return void this.fire(new c.j(n));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&c.e(m,{resourceTiming:p}),this.fire(new c.k("data",Object.assign(Object.assign({},m),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},m),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(t,s){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const l={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(n,l,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?s(null):p?s(p):(t.loadVectorData(m,this.map.painter,n==="reloadTile"),s(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var ji=c.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zi extends c.E{constructor(t,s,n,l){super(),this.load=(p,m)=>{this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=ei.getImage(this.map._requestManager.transformRequest(this.url,Pt.Image),(g,y)=>{this._request=null,this._loaded=!0,g?this.fire(new c.j(g)):y&&(this.image=y,p&&(this.coordinates=p),m&&m(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const p=this.map.painter.context,m=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,ji.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new mt(p,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=n,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=s}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const s=t.map(c.U.fromLngLat);this.tileID=function(l){let p=1/0,m=1/0,g=-1/0,y=-1/0;for(const E of l)p=Math.min(p,E.x),m=Math.min(m,E.y),g=Math.max(g,E.x),y=Math.max(y,E.y);const v=Math.max(g-p,y-m),w=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),S=Math.pow(2,w);return new c.W(w,Math.floor((p+g)/2*S),Math.floor((m+y)/2*S))}(s),this.minzoom=this.maxzoom=this.tileID.z;const n=s.map(l=>this.tileID.getTilePoint(l)._round());return this._boundsArray=new c.V,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,c.N,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,c.N),this._boundsArray.emplaceBack(n[2].x,n[2].y,c.N,c.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,s){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},s(null)):(t.state="errored",s(null))}hasTransition(){return!1}}class Gs extends zi{constructor(t,s,n,l){super(t,s,n,l),this.load=()=>{this._loaded=!1;const p=this.options;this.urls=[];for(const m of p.urls)this.urls.push(this.map._requestManager.transformRequest(m,Pt.Source).url);c.X(this.urls,(m,g)=>{this._loaded=!0,m?this.fire(new c.j(m)):g&&(this.video=g,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const p=this.map.painter.context,m=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,ji.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.texSubImage2D(m.TEXTURE_2D,0,0,0,m.RGBA,m.UNSIGNED_BYTE,this.video)):(this.texture=new mt(p,this.video,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=s}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const s=this.video.seekable;t<s.start(0)||t>s.end(0)?this.fire(new c.j(new c.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class Er extends zi{constructor(t,s,n,l){super(t,s,n,l),this.load=()=>{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.j(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())},this.prepare=()=>{let p=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,p=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,p=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const m=this.map.painter.context,g=m.gl;this.boundsBuffer||(this.boundsBuffer=m.createVertexBuffer(this._boundsArray,ji.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture?(p||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new mt(m,this.canvas,g.RGBA,{premultiply:!0});let y=!1;for(const v in this.tiles){const w=this.tiles[v];w.state!=="loaded"&&(w.state="loaded",w.texture=this.texture,y=!0)}y&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new c.j(new c.Y(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.Y(`sources.${t}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new c.j(new c.Y(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.Y(`sources.${t}`,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.j(new c.Y(`sources.${t}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Xs={},ur=h=>{switch(h){case"geojson":return Mr;case"image":return zi;case"raster":return ms;case"raster-dem":return gs;case"vector":return qr;case"video":return Gs;case"canvas":return Er}return Xs[h]};function _s(h,t){const s=c.Z();return c.$(s,s,[1,1,0]),c.a0(s,s,[.5*h.width,.5*h.height,1]),c.a1(s,s,h.calculatePosMatrix(t.toUnwrapped()))}function Zr(h,t,s,n,l,p){const m=function(S,E,B){if(S)for(const L of S){const F=E[L];if(F&&F.source===B&&F.type==="fill-extrusion")return!0}else for(const L in E){const F=E[L];if(F.source===B&&F.type==="fill-extrusion")return!0}return!1}(l&&l.layers,t,h.id),g=p.maxPitchScaleFactor(),y=h.tilesIn(n,g,m);y.sort(Cr);const v=[];for(const S of y)v.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(t,s,h._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,l,p,g,_s(h.transform,S.tileID))});const w=function(S){const E={},B={};for(const L of S){const F=L.queryResults,z=L.wrappedTileID,G=B[z]=B[z]||{};for(const J in F){const U=F[J],X=G[J]=G[J]||{},ee=E[J]=E[J]||[];for(const te of U)X[te.featureIndex]||(X[te.featureIndex]=!0,ee.push(te))}}return E}(v);for(const S in w)w[S].forEach(E=>{const B=E.feature,L=h.getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=L});return w}function Cr(h,t){const s=h.tileID,n=t.tileID;return s.overscaledZ-n.overscaledZ||s.canonical.y-n.canonical.y||s.wrap-n.wrap||s.canonical.x-n.canonical.x}class Pr{constructor(t,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.a2(),this.uses=0,this.tileSize=s,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(t){const s=t+this.timeAdded;s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,s,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(l,p){const m={};if(!p)return m;for(const g of l){const y=g.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(v=>y.filter(w=>w.id===v)[0]));for(const v of y)m[v.id]=g}}return m}(t.buckets,s.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const p=this.buckets[l];if(p instanceof c.a4){if(this.hasSymbolBuckets=!0,!n)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const p=this.buckets[l];if(p instanceof c.a4&&p.hasRTLText){this.hasRTLText=!0,c.a5();break}}this.queryPadding=0;for(const l in this.buckets){const p=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(l).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.a3}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const n in this.buckets){const l=this.buckets[n];l.uploadPending()&&l.upload(t)}const s=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new mt(t,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new mt(t,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,s,n,l,p,m,g,y,v,w){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:w,transform:y,params:g,queryPadding:this.queryPadding*v},t,s,n):{}}querySourceFeatures(t,s){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const l=n.loadVTLayers(),p=s&&s.sourceLayer?s.sourceLayer:"",m=l._geojsonTileLayer||l[p];if(!m)return;const g=c.a6(s&&s.filter),{z:y,x:v,y:w}=this.tileID.canonical,S={z:y,x:v,y:w};for(let E=0;E<m.length;E++){const B=m.feature(E);if(g.needGeometry){const z=c.a7(B,!0);if(!g.filter(new c.a8(this.tileID.overscaledZ),z,this.tileID.canonical))continue}else if(!g.filter(new c.a8(this.tileID.overscaledZ),B))continue;const L=n.getId(B,p),F=new c.a9(B,y,v,w,L);F.tile=S,t.push(F)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const s=this.expirationTime;if(t.cacheControl){const n=c.aa(t.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const n=Date.now();let l=!1;if(this.expirationTime>n)l=!1;else if(s)if(this.expirationTime<s)l=!0;else{const p=this.expirationTime-s;p?this.expirationTime=n+Math.max(p,3e4):l=!0}else l=!0;l?(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(t,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const n=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!s.style.hasLayer(l))continue;const p=this.buckets[l],m=p.layers[0].sourceLayer||"_geojsonTileLayer",g=n[m],y=t[m];if(!g||!y||Object.keys(y).length===0)continue;p.update(y,g,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=s&&s.style&&s.style.getLayer(l);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c.h.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=c.h.now()+t}setDependencies(t,s){const n={};for(const l of s)n[l]=!0;this.dependencies[t]=n}hasDependency(t,s){for(const n of t){const l=this.dependencies[n];if(l){for(const p of s)if(l[p])return!0}}return!1}}class Gr{constructor(t,s){this.max=t,this.onRemove=s,this.reset()}reset(){for(const t in this.data)for(const s of this.data[t])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(t,s,n){const l=t.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const p={value:s,timeout:void 0};if(n!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},n)),this.data[l].push(p),this.order.push(l),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const s=this.data[t].shift();return s.timeout&&clearTimeout(s.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),s.value}getByKey(t){const s=this.data[t];return s?s[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,s){if(!this.has(t))return this;const n=t.wrapped().key,l=s===void 0?0:this.data[n].indexOf(s),p=this.data[n][l];return this.data[n].splice(l,1),p.timeout&&clearTimeout(p.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(p.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(t){const s=[];for(const n in this.data)for(const l of this.data[n])t(l.value)||s.push(l);for(const n of s)this.remove(n.value.tileID,n)}}class re{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,s,n){const l=String(s);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][l]=this.stateChanges[t][l]||{},c.e(this.stateChanges[t][l],n),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==l&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][l]===null){this.deletedStates[t][l]={};for(const p in this.state[t][l])n[p]||(this.deletedStates[t][l][p]=null)}else for(const p in n)this.deletedStates[t]&&this.deletedStates[t][l]&&this.deletedStates[t][l][p]===null&&delete this.deletedStates[t][l][p]}removeFeatureState(t,s,n){if(this.deletedStates[t]===null)return;const l=String(s);if(this.deletedStates[t]=this.deletedStates[t]||{},n&&s!==void 0)this.deletedStates[t][l]!==null&&(this.deletedStates[t][l]=this.deletedStates[t][l]||{},this.deletedStates[t][l][n]=null);else if(s!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][l])for(n in this.deletedStates[t][l]={},this.stateChanges[t][l])this.deletedStates[t][l][n]=null;else this.deletedStates[t][l]=null;else this.deletedStates[t]=null}getState(t,s){const n=String(s),l=c.e({},(this.state[t]||{})[n],(this.stateChanges[t]||{})[n]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][s];if(p===null)return{};for(const m in p)delete l[m]}return l}initializeTileState(t,s){t.setFeatureState(this.state,s)}coalesceChanges(t,s){const n={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const p={};for(const m in this.stateChanges[l])this.state[l][m]||(this.state[l][m]={}),c.e(this.state[l][m],this.stateChanges[l][m]),p[m]=this.state[l][m];n[l]=p}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const p={};if(this.deletedStates[l]===null)for(const m in this.state[l])p[m]={},this.state[l][m]={};else for(const m in this.deletedStates[l]){if(this.deletedStates[l][m]===null)this.state[l][m]={};else for(const g of Object.keys(this.deletedStates[l][m]))delete this.state[l][m][g];p[m]=this.state[l][m]}n[l]=n[l]||{},c.e(n[l],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const l in t)t[l].setFeatureState(n,s)}}class ui extends c.E{constructor(t,s,n){super(),this.id=t,this.dispatcher=n,this.on("data",l=>{l.dataType==="source"&&l.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&l.dataType==="source"&&l.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,p,m,g)=>{const y=new(ur(p.type))(l,p,m,g);if(y.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${y.id}`);return y})(t,s,n,this),this._tiles={},this._cache=new Gr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new re,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}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 t in this._tiles){const s=this._tiles[t];if(s.state!=="loaded"&&s.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,s){return this._source.loadTile(t,s)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const n=this._tiles[s];n.upload(t),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Di).map(t=>t.key)}getRenderableIds(t){const s=[];for(const n in this._tiles)this._isIdRenderable(n,t)&&s.push(this._tiles[n]);return t?s.sort((n,l)=>{const p=n.tileID,m=l.tileID,g=new c.P(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new c.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(n=>n.tileID.key):s.map(n=>n.tileID).sort(Di).map(n=>n.key)}hasRenderableParent(t){const s=this.findLoadedParent(t,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(t,s){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(s||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,s){const n=this._tiles[t];n&&(n.state!=="loading"&&(n.state=s),this._loadTile(n,this._tileLoaded.bind(this,n,t,s)))}_tileLoaded(t,s,n,l){if(l)return t.state="errored",void(l.status!==404?this._source.fire(new c.j(l,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.h.now(),n==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(s,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const s=this.getRenderableIds();for(let l=0;l<s.length;l++){const p=s[l];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);n(t,m),n(m,t)}}function n(l,p){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-l.tileID.canonical.x;const g=p.tileID.canonical.y-l.tileID.canonical.y,y=Math.pow(2,l.tileID.canonical.z),v=p.tileID.key;m===0&&g===0||Math.abs(g)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),p.dem&&l.dem&&(l.dem.backfillBorder(p.dem,m,g),l.neighboringTiles&&l.neighboringTiles[v]&&(l.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,s,n,l){for(const p in this._tiles){let m=this._tiles[p];if(l[p]||!m.hasData()||m.tileID.overscaledZ<=s||m.tileID.overscaledZ>n)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>s+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(g=v)}let y=g;for(;y.overscaledZ>s;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){l[g.key]=g;break}}}findLoadedParent(t,s){if(t.key in this._loadedParentTiles){const n=this._loadedParentTiles[t.key];return n&&n.tileID.overscaledZ>=s?n:null}for(let n=t.overscaledZ-1;n>=s;n--){const l=t.scaledTo(n),p=this._getLoadedTile(l);if(p)return p}}_getLoadedTile(t){const s=this._tiles[t.key];return s&&s.hasData()?s:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const s=Math.ceil(t.width/this._source.tileSize)+1,n=Math.ceil(t.height/this._source.tileSize)+1,l=Math.floor(s*n*(this._maxTileCacheZoomLevels===null?c.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(p)}handleWrapJump(t){const s=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,s){const n={};for(const l in this._tiles){const p=this._tiles[l];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+s),n[p.tileID.key]=p}this._tiles=n;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}update(t,s){if(this.transform=t,this.terrain=s,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(w=>new c.O(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y)):(n=t.coveringTiles({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:s}),this._source.hasTile&&(n=n.filter(w=>this._source.hasTile(w)))):n=[];const l=t.coveringZoomLevel(this._source),p=Math.max(l-ui.maxOverzooming,this._source.minzoom),m=Math.max(l+ui.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const w={};for(const S of n)if(S.canonical.z>this._source.minzoom){const E=S.scaledTo(S.canonical.z-1);w[E.key]=E;const B=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));w[B.key]=B}n=n.concat(Object.values(w))}const g=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(n,l);if(nt(this._source.type)){const w={},S={},E=Object.keys(y),B=c.h.now();for(const L of E){const F=y[L],z=this._tiles[L];if(!z||z.fadeEndTime!==0&&z.fadeEndTime<=B)continue;const G=this.findLoadedParent(F,p);G&&(this._addTile(G.tileID),w[G.tileID.key]=G.tileID),S[L]=F}this._retainLoadedChildren(S,l,m,y);for(const L in w)y[L]||(this._coveredTiles[L]=!0,y[L]=w[L]);if(s){const L={},F={};for(const z of n)this._tiles[z.key].hasData()?L[z.key]=z:F[z.key]=z;for(const z in F){const G=F[z].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(L[G[0].key]=y[G[0].key]=G[0],L[G[1].key]=y[G[1].key]=G[1],L[G[2].key]=y[G[2].key]=G[2],L[G[3].key]=y[G[3].key]=G[3],delete F[z])}for(const z in F){const G=this.findLoadedParent(F[z],this._source.minzoom);if(G){L[G.tileID.key]=y[G.tileID.key]=G.tileID;for(const J in L)L[J].isChildOf(G.tileID)&&delete L[J]}}for(const z in this._tiles)L[z]||(this._coveredTiles[z]=!0)}}for(const w in y)this._tiles[w].clearFadeHold();const v=c.ab(this._tiles,y);for(const w of v){const S=this._tiles[w];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(w)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,s){const n={},l={},p=Math.max(s-ui.maxOverzooming,this._source.minzoom),m=Math.max(s+ui.maxUnderzooming,this._source.minzoom),g={};for(const y of t){const v=this._addTile(y);n[y.key]=y,v.hasData()||s<this._source.maxzoom&&(g[y.key]=y)}this._retainLoadedChildren(g,s,m,n);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(s+1>this._source.maxzoom){const S=y.children(this._source.maxzoom)[0],E=this.getTile(S);if(E&&E.hasData()){n[S.key]=S;continue}}else{const S=y.children(this._source.maxzoom);if(n[S[0].key]&&n[S[1].key]&&n[S[2].key]&&n[S[3].key])continue}let w=v.wasRequested();for(let S=y.overscaledZ-1;S>=p;--S){const E=y.scaledTo(S);if(l[E.key])break;if(l[E.key]=!0,v=this.getTile(E),!v&&w&&(v=this._addTile(E)),v){const B=v.hasData();if((w||B)&&(n[E.key]=E),w=v.wasRequested(),B)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const s=[];let n,l=this._tiles[t].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){n=this._loadedParentTiles[l.key];break}s.push(l.key);const p=l.scaledTo(l.overscaledZ-1);if(n=this._getLoadedTile(p),n)break;l=p}for(const p of s)this._loadedParentTiles[p]=n}}_addTile(t){let s=this._tiles[t.key];if(s)return s;s=this._cache.getAndRemove(t),s&&(this._setTileReloadTimer(t.key,s),s.tileID=t,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,s)));const n=s;return s||(s=new Pr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(s,this._tileLoaded.bind(this,s,t.key,s.state))),s.uses++,this._tiles[t.key]=s,n||this._source.fire(new c.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(t,s){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const n=s.getExpiryTimeout();n&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},n))}_removeTile(t){const s=this._tiles[t];s&&(s.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,s,n){const l=[],p=this.transform;if(!p)return l;const m=n?p.getCameraQueryGeometry(t):t,g=t.map(L=>p.pointCoordinate(L,this.terrain)),y=m.map(L=>p.pointCoordinate(L,this.terrain)),v=this.getIds();let w=1/0,S=1/0,E=-1/0,B=-1/0;for(const L of y)w=Math.min(w,L.x),S=Math.min(S,L.y),E=Math.max(E,L.x),B=Math.max(B,L.y);for(let L=0;L<v.length;L++){const F=this._tiles[v[L]];if(F.holdingForFade())continue;const z=F.tileID,G=Math.pow(2,p.zoom-F.tileID.overscaledZ),J=s*F.queryPadding*c.N/F.tileSize/G,U=[z.getTilePoint(new c.U(w,S)),z.getTilePoint(new c.U(E,B))];if(U[0].x-J<c.N&&U[0].y-J<c.N&&U[1].x+J>=0&&U[1].y+J>=0){const X=g.map(te=>z.getTilePoint(te)),ee=y.map(te=>z.getTilePoint(te));l.push({tile:F,tileID:z,queryGeometry:X,cameraQueryGeometry:ee,scale:G})}}return l}getVisibleCoordinates(t){const s=this.getRenderableIds(t).map(n=>this._tiles[n].tileID);for(const n of s)n.posMatrix=this.transform.calculatePosMatrix(n.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(nt(this._source.type)){const t=c.h.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=t)return!0}return!1}setFeatureState(t,s,n){this._state.updateState(t=t||"_geojsonTileLayer",s,n)}removeFeatureState(t,s,n){this._state.removeFeatureState(t=t||"_geojsonTileLayer",s,n)}getFeatureState(t,s){return this._state.getState(t=t||"_geojsonTileLayer",s)}setDependencies(t,s,n){const l=this._tiles[t];l&&l.setDependencies(s,n)}reloadTilesForDependencies(t,s){for(const n in this._tiles)this._tiles[n].hasDependency(t,s)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(t,s))}}function Di(h,t){const s=Math.abs(2*h.wrap)-+(h.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||n-s||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function nt(h){return h==="raster"||h==="image"||h==="video"}ui.maxOverzooming=10,ui.maxUnderzooming=3;const Ye="mapboxgl_preloaded_worker_pool";class Ji{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ji.workerCount;)this.workers.push(new Worker(c.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(s=>{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ye]}numActive(){return Object.keys(this.active).length}}const ys=Math.floor(c.h.hardwareConcurrency/2);let pr;function ya(){return pr||(pr=new Ji),pr}Ji.workerCount=c.ac(globalThis)?Math.max(Math.min(ys,3),1):1;class xs{constructor(t,s){this.reset(t,s)}reset(t,s){this.points=t||[],this._distances=[0];for(let n=1;n<this.points.length;n++)this._distances[n]=this._distances[n-1]+this.points[n].dist(this.points[n-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(s||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.ad(t,0,1);let s=1,n=this._distances[s];const l=t*this.paddedLength+this.padding;for(;n<l&&s<this._distances.length;)n=this._distances[++s];const p=s-1,m=this._distances[p],g=n-m,y=g>0?(l-m)/g:0;return this.points[p].mult(1-y).add(this.points[s].mult(y))}}function kr(h,t){let s=!0;return h==="always"||h!=="never"&&t!=="never"||(s=!1),s}class Xr{constructor(t,s,n){const l=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(s/n);for(let m=0;m<this.xCellCount*this.yCellCount;m++)l.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=s,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,s,n,l,p){this._forEachCell(s,n,l,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(s),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(p)}insertCircle(t,s,n,l){this._forEachCell(s-l,n-l,s+l,n+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(s),this.circles.push(n),this.circles.push(l)}_insertBoxCell(t,s,n,l,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,s,n,l,p,m){this.circleCells[p].push(m)}_query(t,s,n,l,p,m,g){if(n<0||t>this.width||l<0||s>this.height)return[];const y=[];if(t<=0&&s<=0&&this.width<=n&&this.height<=l){if(p)return[{key:null,x1:t,y1:s,x2:n,y2:l}];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],S=this.circles[3*v+1],E=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:w-E,y1:S-E,x2:w+E,y2:S+E})}}else this._forEachCell(t,s,n,l,this._queryCell,y,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},g);return y}query(t,s,n,l){return this._query(t,s,n,l,!1,null)}hitTest(t,s,n,l,p,m){return this._query(t,s,n,l,!0,p,m).length>0}hitTestCircle(t,s,n,l,p){const m=t-n,g=t+n,y=s-n,v=s+n;if(g<0||m>this.width||v<0||y>this.height)return!1;const w=[];return this._forEachCell(m,y,g,v,this._queryCellCircle,w,{hitTest:!0,overlapMode:l,circle:{x:t,y:s,radius:n},seenUids:{box:{},circle:{}}},p),w.length>0}_queryCell(t,s,n,l,p,m,g,y){const{seenUids:v,hitTest:w,overlapMode:S}=g,E=this.boxCells[p];if(E!==null){const L=this.bboxes;for(const F of E)if(!v.box[F]){v.box[F]=!0;const z=4*F,G=this.boxKeys[F];if(t<=L[z+2]&&s<=L[z+3]&&n>=L[z+0]&&l>=L[z+1]&&(!y||y(G))&&(!w||!kr(S,G.overlapMode))&&(m.push({key:G,x1:L[z],y1:L[z+1],x2:L[z+2],y2:L[z+3]}),w))return!0}}const B=this.circleCells[p];if(B!==null){const L=this.circles;for(const F of B)if(!v.circle[F]){v.circle[F]=!0;const z=3*F,G=this.circleKeys[F];if(this._circleAndRectCollide(L[z],L[z+1],L[z+2],t,s,n,l)&&(!y||y(G))&&(!w||!kr(S,G.overlapMode))){const J=L[z],U=L[z+1],X=L[z+2];if(m.push({key:G,x1:J-X,y1:U-X,x2:J+X,y2:U+X}),w)return!0}}}return!1}_queryCellCircle(t,s,n,l,p,m,g,y){const{circle:v,seenUids:w,overlapMode:S}=g,E=this.boxCells[p];if(E!==null){const L=this.bboxes;for(const F of E)if(!w.box[F]){w.box[F]=!0;const z=4*F,G=this.boxKeys[F];if(this._circleAndRectCollide(v.x,v.y,v.radius,L[z+0],L[z+1],L[z+2],L[z+3])&&(!y||y(G))&&!kr(S,G.overlapMode))return m.push(!0),!0}}const B=this.circleCells[p];if(B!==null){const L=this.circles;for(const F of B)if(!w.circle[F]){w.circle[F]=!0;const z=3*F,G=this.circleKeys[F];if(this._circlesCollide(L[z],L[z+1],L[z+2],v.x,v.y,v.radius)&&(!y||y(G))&&!kr(S,G.overlapMode))return m.push(!0),!0}}}_forEachCell(t,s,n,l,p,m,g,y){const v=this._convertToXCellCoord(t),w=this._convertToYCellCoord(s),S=this._convertToXCellCoord(n),E=this._convertToYCellCoord(l);for(let B=v;B<=S;B++)for(let L=w;L<=E;L++)if(p.call(this,t,s,n,l,this.xCellCount*L+B,m,g,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,s,n,l,p,m){const g=l-t,y=p-s,v=n+m;return v*v>g*g+y*y}_circleAndRectCollide(t,s,n,l,p,m,g){const y=(m-l)/2,v=Math.abs(t-(l+y));if(v>y+n)return!1;const w=(g-p)/2,S=Math.abs(s-(p+w));if(S>w+n)return!1;if(v<=y||S<=w)return!0;const E=v-y,B=S-w;return E*E+B*B<=n*n}}function fe(h,t,s,n,l){const p=c.Z();return t?(c.a0(p,p,[1/l,1/l,1]),s||c.ae(p,p,n.angle)):c.a1(p,n.labelPlaneMatrix,h),p}function Qi(h,t,s,n,l){if(t){const p=c.af(h);return c.a0(p,p,[l,l,1]),s||c.ae(p,p,-n.angle),p}return n.glCoordMatrix}function vt(h,t,s){let n;s?(n=[h.x,h.y,s(h.x,h.y),1],c.ag(n,n,t)):(n=[h.x,h.y,0,1],O(n,n,t));const l=n[3];return{point:new c.P(n[0]/l,n[1]/l),signedDistanceFromCamera:l}}function Wr(h,t){return .5+h/t*.5}function dr(h,t){const s=h[0]/h[3],n=h[1]/h[3];return s>=-t[0]&&s<=t[0]&&n>=-t[1]&&n<=t[1]}function ge(h,t,s,n,l,p,m,g,y,v){const w=n?h.textSizeData:h.iconSizeData,S=c.ah(w,s.transform.zoom),E=[256/s.width*2+1,256/s.height*2+1],B=n?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;B.clear();const L=h.lineVertexArray,F=n?h.text.placedSymbolArray:h.icon.placedSymbolArray,z=s.transform.width/s.transform.height;let G=!1;for(let J=0;J<F.length;J++){const U=F.get(J);if(U.hidden||U.writingMode===c.ai.vertical&&!G){k(U.numGlyphs,B);continue}let X;if(G=!1,v?(X=[U.anchorX,U.anchorY,v(U.anchorX,U.anchorY),1],c.ag(X,X,t)):(X=[U.anchorX,U.anchorY,0,1],O(X,X,t)),!dr(X,E)){k(U.numGlyphs,B);continue}const ee=Wr(s.transform.cameraToCenterDistance,X[3]),te=c.aj(w,S,U),ne=m?te/ee:te*ee,he=new c.P(U.anchorX,U.anchorY),ce=vt(he,l,v).point,pe={projections:{},offsets:{}},Ie=ii(U,ne,!1,g,t,l,p,h.glyphOffsetArray,L,B,ce,he,pe,z,y,v);G=Ie.useVertical,(Ie.notEnoughRoom||G||Ie.needsFlipping&&ii(U,ne,!0,g,t,l,p,h.glyphOffsetArray,L,B,ce,he,pe,z,y,v).notEnoughRoom)&&k(U.numGlyphs,B)}n?h.text.dynamicLayoutVertexBuffer.updateData(B):h.icon.dynamicLayoutVertexBuffer.updateData(B)}function Ue(h,t,s,n,l,p,m,g,y,v,w,S,E){const B=g.glyphStartIndex+g.numGlyphs,L=g.lineStartIndex,F=g.lineStartIndex+g.lineLength,z=t.getoffsetX(g.glyphStartIndex),G=t.getoffsetX(B-1),J=I(h*z,s,n,l,p,m,g.segment,L,F,y,v,w,S,E);if(!J)return null;const U=I(h*G,s,n,l,p,m,g.segment,L,F,y,v,w,S,E);return U?{first:J,last:U}:null}function Fe(h,t,s,n){return h===c.ai.horizontal&&Math.abs(s.y-t.y)>Math.abs(s.x-t.x)*n?{useVertical:!0}:(h===c.ai.vertical?t.y<s.y:t.x>s.x)?{needsFlipping:!0}:null}function ii(h,t,s,n,l,p,m,g,y,v,w,S,E,B,L,F){const z=t/24,G=h.lineOffsetX*z,J=h.lineOffsetY*z;let U;if(h.numGlyphs>1){const X=h.glyphStartIndex+h.numGlyphs,ee=h.lineStartIndex,te=h.lineStartIndex+h.lineLength,ne=Ue(z,g,G,J,s,w,S,h,y,p,E,L,F);if(!ne)return{notEnoughRoom:!0};const he=vt(ne.first.point,m,F).point,ce=vt(ne.last.point,m,F).point;if(n&&!s){const pe=Fe(h.writingMode,he,ce,B);if(pe)return pe}U=[ne.first];for(let pe=h.glyphStartIndex+1;pe<X-1;pe++)U.push(I(z*g.getoffsetX(pe),G,J,s,w,S,h.segment,ee,te,y,p,E,L,F));U.push(ne.last)}else{if(n&&!s){const ee=vt(S,l,F).point,te=h.lineStartIndex+h.segment+1,ne=new c.P(y.getx(te),y.gety(te)),he=vt(ne,l,F),ce=he.signedDistanceFromCamera>0?he.point:er(S,ne,ee,1,l,F),pe=Fe(h.writingMode,ee,ce,B);if(pe)return pe}const X=I(z*g.getoffsetX(h.glyphStartIndex),G,J,s,w,S,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,y,p,E,L,F);if(!X)return{notEnoughRoom:!0};U=[X]}for(const X of U)c.ak(v,X.point,X.angle);return{}}function er(h,t,s,n,l,p){const m=vt(h.add(h.sub(t)._unit()),l,p).point,g=s.sub(m);return s.add(g._mult(n/g.mag()))}function Ve(h,t){const{projectionCache:s,lineVertexArray:n,labelPlaneMatrix:l,tileAnchorPoint:p,distanceFromAnchor:m,getElevation:g,previousVertex:y,direction:v,absOffsetX:w}=t;if(s.projections[h])return s.projections[h];const S=new c.P(n.getx(h),n.gety(h)),E=vt(S,l,g);if(E.signedDistanceFromCamera>0)return s.projections[h]=E.point,E.point;const B=h-v;return er(m===0?p:new c.P(n.getx(B),n.gety(B)),S,y,w-m+1,l,g)}function fr(h,t,s){return h._unit()._perp()._mult(t*s)}function R(h,t,s,n,l,p,m,g){const{projectionCache:y,direction:v}=g;if(y.offsets[h])return y.offsets[h];const w=s.add(t);if(h+v<n||h+v>=l)return y.offsets[h]=w,w;const S=Ve(h+v,g),E=fr(S.sub(s),m,v),B=s.add(E),L=S.add(E);return y.offsets[h]=c.al(p,w,B,L)||w,y.offsets[h]}function I(h,t,s,n,l,p,m,g,y,v,w,S,E,B){const L=n?h-t:h+t;let F=L>0?1:-1,z=0;n&&(F*=-1,z=Math.PI),F<0&&(z+=Math.PI);let G,J,U=F>0?g+m:g+m+1,X=l,ee=l,te=0,ne=0;const he=Math.abs(L),ce=[];let pe;for(;te+ne<=he;){if(U+=F,U<g||U>=y)return null;te+=ne,ee=X,J=G;const _e={projectionCache:S,lineVertexArray:v,labelPlaneMatrix:w,tileAnchorPoint:p,distanceFromAnchor:te,getElevation:B,previousVertex:ee,direction:F,absOffsetX:he};if(X=Ve(U,_e),s===0)ce.push(ee),pe=X.sub(ee);else{let Le;const Me=X.sub(ee);Le=Me.mag()===0?fr(Ve(U+F,_e).sub(X),s,F):fr(Me,s,F),J||(J=ee.add(Le)),G=R(U,Le,X,g,y,J,s,_e),ce.push(J),pe=G.sub(J)}ne=pe.mag()}const Ie=pe._mult((he-te)/ne)._add(J||ee),qe=z+Math.atan2(X.y-ee.y,X.x-ee.x);return ce.push(Ie),{point:Ie,angle:E?qe:0,path:ce}}const M=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function k(h,t){for(let s=0;s<h;s++){const n=t.length;t.resize(n+4),t.float32.set(M,3*n)}}function O(h,t,s){const n=t[0],l=t[1];return h[0]=s[0]*n+s[4]*l+s[12],h[1]=s[1]*n+s[5]*l+s[13],h[3]=s[3]*n+s[7]*l+s[15],h}const N=100;class K{constructor(t,s=new Xr(t.width+200,t.height+200,25),n=new Xr(t.width+200,t.height+200,25)){this.transform=t,this.grid=s,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+N,this.screenBottomBoundary=t.height+N,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,s,n,l,p,m){const g=this.projectAndGetPerspectiveRatio(l,t.anchorPointX,t.anchorPointY,m),y=n*g.perspectiveRatio,v=t.x1*y+g.point.x,w=t.y1*y+g.point.y,S=t.x2*y+g.point.x,E=t.y2*y+g.point.y;return!this.isInsideGrid(v,w,S,E)||s!=="always"&&this.grid.hitTest(v,w,S,E,s,p)||g.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,w,S,E],offscreen:this.isOffscreen(v,w,S,E)}}placeCollisionCircles(t,s,n,l,p,m,g,y,v,w,S,E,B,L){const F=[],z=new c.P(s.anchorX,s.anchorY),G=vt(z,m,L),J=Wr(this.transform.cameraToCenterDistance,G.signedDistanceFromCamera),U=(w?p/J:p*J)/c.ap,X=vt(z,g,L).point,ee=Ue(U,l,s.lineOffsetX*U,s.lineOffsetY*U,!1,X,z,s,n,g,{projections:{},offsets:{}},!1,L);let te=!1,ne=!1,he=!0;if(ee){const ce=.5*E*J+B,pe=new c.P(-100,-100),Ie=new c.P(this.screenRightBoundary,this.screenBottomBoundary),qe=new xs,_e=ee.first,Le=ee.last;let Me=[];for(let Ne=_e.path.length-1;Ne>=1;Ne--)Me.push(_e.path[Ne]);for(let Ne=1;Ne<Le.path.length;Ne++)Me.push(Le.path[Ne]);const rt=2.5*ce;if(y){const Ne=Me.map(Ze=>vt(Ze,y,L));Me=Ne.some(Ze=>Ze.signedDistanceFromCamera<=0)?[]:Ne.map(Ze=>Ze.point)}let je=[];if(Me.length>0){const Ne=Me[0].clone(),Ze=Me[0].clone();for(let Tt=1;Tt<Me.length;Tt++)Ne.x=Math.min(Ne.x,Me[Tt].x),Ne.y=Math.min(Ne.y,Me[Tt].y),Ze.x=Math.max(Ze.x,Me[Tt].x),Ze.y=Math.max(Ze.y,Me[Tt].y);je=Ne.x>=pe.x&&Ze.x<=Ie.x&&Ne.y>=pe.y&&Ze.y<=Ie.y?[Me]:Ze.x<pe.x||Ne.x>Ie.x||Ze.y<pe.y||Ne.y>Ie.y?[]:c.am([Me],pe.x,pe.y,Ie.x,Ie.y)}for(const Ne of je){qe.reset(Ne,.25*ce);let Ze=0;Ze=qe.length<=.5*ce?1:Math.ceil(qe.paddedLength/rt)+1;for(let Tt=0;Tt<Ze;Tt++){const lt=Tt/Math.max(Ze-1,1),Zt=qe.lerp(lt),Lt=Zt.x+N,Et=Zt.y+N;F.push(Lt,Et,ce,0);const Ai=Lt-ce,ut=Et-ce,ir=Lt+ce,rr=Et+ce;if(he=he&&this.isOffscreen(Ai,ut,ir,rr),ne=ne||this.isInsideGrid(Ai,ut,ir,rr),t!=="always"&&this.grid.hitTestCircle(Lt,Et,ce,t,S)&&(te=!0,!v))return{circles:[],offscreen:!1,collisionDetected:te}}}}return{circles:!v&&te||!ne||J<this.perspectiveRatioCutoff?[]:F,offscreen:he,collisionDetected:te}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const s=[];let n=1/0,l=1/0,p=-1/0,m=-1/0;for(const w of t){const S=new c.P(w.x+N,w.y+N);n=Math.min(n,S.x),l=Math.min(l,S.y),p=Math.max(p,S.x),m=Math.max(m,S.y),s.push(S)}const g=this.grid.query(n,l,p,m).concat(this.ignoredGrid.query(n,l,p,m)),y={},v={};for(const w of g){const S=w.key;if(y[S.bucketInstanceId]===void 0&&(y[S.bucketInstanceId]={}),y[S.bucketInstanceId][S.featureIndex])continue;const E=[new c.P(w.x1,w.y1),new c.P(w.x2,w.y1),new c.P(w.x2,w.y2),new c.P(w.x1,w.y2)];c.an(s,E)&&(y[S.bucketInstanceId][S.featureIndex]=!0,v[S.bucketInstanceId]===void 0&&(v[S.bucketInstanceId]=[]),v[S.bucketInstanceId].push(S.featureIndex))}return v}insertCollisionBox(t,s,n,l,p,m){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:p,collisionGroupID:m,overlapMode:s},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,s,n,l,p,m){const g=n?this.ignoredGrid:this.grid,y={bucketInstanceId:l,featureIndex:p,collisionGroupID:m,overlapMode:s};for(let v=0;v<t.length;v+=4)g.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,s,n,l){let p;return l?(p=[s,n,l(s,n),1],c.ag(p,p,t)):(p=[s,n,0,1],O(p,p,t)),{point:new c.P((p[0]/p[3]+1)/2*this.transform.width+N,(-p[1]/p[3]+1)/2*this.transform.height+N),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,s,n,l){return n<N||t>=this.screenRightBoundary||l<N||s>this.screenBottomBoundary}isInsideGrid(t,s,n,l){return n>=0&&t<this.gridRightBoundary&&l>=0&&s<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.$(t,t,[-100,-100,0]),t}}function Z(h,t,s){return t*(c.N/(h.tileSize*Math.pow(2,s-h.tileID.overscaledZ)))}class j{constructor(t,s,n,l){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?s:-s))):l&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class W{constructor(t,s,n,l,p){this.text=new j(t?t.text:null,s,n,p),this.icon=new j(t?t.icon:null,s,l,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class se{constructor(t,s,n){this.text=t,this.icon=s,this.skipFade=n}}class ae{constructor(){this.invProjMatrix=c.Z(),this.viewportMatrix=c.Z(),this.circles=[]}}class le{constructor(t,s,n,l,p){this.bucketInstanceId=t,this.featureIndex=s,this.sourceLayerIndex=n,this.bucketIndex=l,this.tileID=p}}class Pe{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const s=++this.maxGroupID;this.collisionGroups[t]={ID:s,predicate:n=>n.collisionGroupID===s}}return this.collisionGroups[t]}}function Re(h,t,s,n,l){const{horizontalAlign:p,verticalAlign:m}=c.au(h);return new c.P(-(p-.5)*t+n[0]*l,-(m-.5)*s+n[1]*l)}function Te(h,t,s,n,l,p){const{x1:m,x2:g,y1:y,y2:v,anchorPointX:w,anchorPointY:S}=h,E=new c.P(t,s);return n&&E._rotate(l?p:-p),{x1:m+E.x,y1:y+E.y,x2:g+E.x,y2:v+E.y,anchorPointX:w,anchorPointY:S}}class ze{constructor(t,s,n,l,p){this.transform=t.clone(),this.terrain=s,this.collisionIndex=new K(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Pe(l),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,s,n,l){const p=n.getBucket(s),m=n.latestFeatureIndex;if(!p||!m||s.id!==p.layerIds[0])return;const g=n.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),w=n.tileSize/c.N,S=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),E=y.get("text-pitch-alignment")==="map",B=y.get("text-rotation-alignment")==="map",L=Z(n,1,this.transform.zoom),F=fe(S,E,B,this.transform,L);let z=null;if(E){const J=Qi(S,E,B,this.transform,L);z=c.a1([],this.transform.labelPlaneMatrix,J)}this.retainedQueryData[p.bucketInstanceId]=new le(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,n.tileID);const G={bucket:p,layout:y,posMatrix:S,textLabelPlaneMatrix:F,labelToScreenMatrix:z,scale:v,textPixelRatio:w,holdingForFade:n.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:c.ah(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(l)for(const J of p.sortKeyRanges){const{sortKey:U,symbolInstanceStart:X,symbolInstanceEnd:ee}=J;t.push({sortKey:U,symbolInstanceStart:X,symbolInstanceEnd:ee,parameters:G})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:G})}attemptAnchorPlacement(t,s,n,l,p,m,g,y,v,w,S,E,B,L,F,z){const G=c.aq[t.textAnchor],J=[t.textOffset0,t.textOffset1],U=Re(G,n,l,J,p),X=this.collisionIndex.placeCollisionBox(Te(s,U.x,U.y,m,g,this.transform.angle),S,y,v,w.predicate,z);if((!F||this.collisionIndex.placeCollisionBox(Te(F,U.x,U.y,m,g,this.transform.angle),S,y,v,w.predicate,z).box.length!==0)&&X.box.length>0){let ee;if(this.prevPlacement&&this.prevPlacement.variableOffsets[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID].text&&(ee=this.prevPlacement.variableOffsets[E.crossTileID].anchor),E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[E.crossTileID]={textOffset:J,width:n,height:l,anchor:G,textBoxScale:p,prevAnchor:ee},this.markUsedJustification(B,G,E,L),B.allowVerticalPlacement&&(this.markUsedOrientation(B,L,E),this.placedOrientations[E.crossTileID]=L),{shift:U,placedGlyphBoxes:X}}}placeLayerBucketPart(t,s,n){const{bucket:l,layout:p,posMatrix:m,textLabelPlaneMatrix:g,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:w,collisionBoxArray:S,partiallyEvaluatedTextSize:E,collisionGroup:B}=t.parameters,L=p.get("text-optional"),F=p.get("icon-optional"),z=c.ar(p,"text-overlap","text-allow-overlap"),G=z==="always",J=c.ar(p,"icon-overlap","icon-allow-overlap"),U=J==="always",X=p.get("text-rotation-alignment")==="map",ee=p.get("text-pitch-alignment")==="map",te=p.get("icon-text-fit")!=="none",ne=p.get("symbol-z-order")==="viewport-y",he=G&&(U||!l.hasIconData()||F),ce=U&&(G||!l.hasTextData()||L);!l.collisionArrays&&S&&l.deserializeCollisionBoxes(S);const pe=this.retainedQueryData[l.bucketInstanceId].tileID,Ie=this.terrain?(_e,Le)=>this.terrain.getElevation(pe,_e,Le):null,qe=(_e,Le)=>{var Me,rt;if(s[_e.crossTileID])return;if(w)return void(this.placements[_e.crossTileID]=new se(!1,!1,!1));let je=!1,Ne=!1,Ze=!0,Tt=null,lt={box:null,offscreen:null},Zt={box:null,offscreen:null},Lt=null,Et=null,Ai=null,ut=0,ir=0,rr=0;Le.textFeatureIndex?ut=Le.textFeatureIndex:_e.useRuntimeCollisionCircles&&(ut=_e.featureIndex),Le.verticalTextFeatureIndex&&(ir=Le.verticalTextFeatureIndex);const Or=Le.textBox;if(Or){const Kt=It=>{let Bt=c.ai.horizontal;if(l.allowVerticalPlacement&&!It&&this.prevPlacement){const fi=this.prevPlacement.placedOrientations[_e.crossTileID];fi&&(this.placedOrientations[_e.crossTileID]=fi,Bt=fi,this.markUsedOrientation(l,Bt,_e))}return Bt},Gt=(It,Bt)=>{if(l.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(const fi of l.writingModes)if(fi===c.ai.vertical?(lt=Bt(),Zt=lt):lt=It(),lt&<.box&<.box.length)break}else lt=It()},si=_e.textAnchorOffsetStartIndex,ss=_e.textAnchorOffsetEndIndex;if(ss===si){const It=(Bt,fi)=>{const At=this.collisionIndex.placeCollisionBox(Bt,z,v,m,B.predicate,Ie);return At&&At.box&&At.box.length&&(this.markUsedOrientation(l,fi,_e),this.placedOrientations[_e.crossTileID]=fi),At};Gt(()=>It(Or,c.ai.horizontal),()=>{const Bt=Le.verticalTextBox;return l.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Bt?It(Bt,c.ai.vertical):{box:null,offscreen:null}}),Kt(lt&<.box&<.box.length)}else{let It=c.aq[(rt=(Me=this.prevPlacement)===null||Me===void 0?void 0:Me.variableOffsets[_e.crossTileID])===null||rt===void 0?void 0:rt.anchor];const Bt=(At,as,Xa)=>{const Yo=At.x2-At.x1,Jo=At.y2-At.y1,Ol=_e.textBoxScale,Xn=te&&J==="never"?as:null;let sr={box:[],offscreen:!1},ns=z==="never"?1:2,ar="never";It&&ns++;for(let Ni=0;Ni<ns;Ni++){for(let nr=si;nr<ss;nr++){const Wn=l.textAnchorOffsets.get(nr);if(It&&Wn.textAnchor!==It)continue;const vr=this.attemptAnchorPlacement(Wn,At,Yo,Jo,Ol,X,ee,v,m,B,ar,_e,l,Xa,Xn,Ie);if(vr&&(sr=vr.placedGlyphBoxes,sr&&sr.box&&sr.box.length))return je=!0,Tt=vr.shift,sr}It?It=null:ar=z}return sr};Gt(()=>Bt(Or,Le.iconBox,c.ai.horizontal),()=>{const At=Le.verticalTextBox;return l.allowVerticalPlacement&&!(lt&<.box&<.box.length)&&_e.numVerticalGlyphVertices>0&&At?Bt(At,Le.verticalIconBox,c.ai.vertical):{box:null,offscreen:null}}),lt&&(je=lt.box,Ze=lt.offscreen);const fi=Kt(lt&<.box);if(!je&&this.prevPlacement){const At=this.prevPlacement.variableOffsets[_e.crossTileID];At&&(this.variableOffsets[_e.crossTileID]=At,this.markUsedJustification(l,At.anchor,_e,fi))}}}if(Lt=lt,je=Lt&&Lt.box&&Lt.box.length>0,Ze=Lt&&Lt.offscreen,_e.useRuntimeCollisionCircles){const Kt=l.text.placedSymbolArray.get(_e.centerJustifiedTextSymbolIndex),Gt=c.aj(l.textSizeData,E,Kt),si=p.get("text-padding");Et=this.collisionIndex.placeCollisionCircles(z,Kt,l.lineVertexArray,l.glyphOffsetArray,Gt,m,g,y,n,ee,B.predicate,_e.collisionCircleDiameter,si,Ie),Et.circles.length&&Et.collisionDetected&&!n&&c.w("Collisions detected, but collision boxes are not shown"),je=G||Et.circles.length>0&&!Et.collisionDetected,Ze=Ze&&Et.offscreen}if(Le.iconFeatureIndex&&(rr=Le.iconFeatureIndex),Le.iconBox){const Kt=Gt=>{const si=te&&Tt?Te(Gt,Tt.x,Tt.y,X,ee,this.transform.angle):Gt;return this.collisionIndex.placeCollisionBox(si,J,v,m,B.predicate,Ie)};Zt&&Zt.box&&Zt.box.length&&Le.verticalIconBox?(Ai=Kt(Le.verticalIconBox),Ne=Ai.box.length>0):(Ai=Kt(Le.iconBox),Ne=Ai.box.length>0),Ze=Ze&&Ai.offscreen}const rs=L||_e.numHorizontalGlyphVertices===0&&_e.numVerticalGlyphVertices===0,Ds=F||_e.numIconVertices===0;if(rs||Ds?Ds?rs||(Ne=Ne&&je):je=Ne&&je:Ne=je=Ne&&je,je&&Lt&&Lt.box&&this.collisionIndex.insertCollisionBox(Lt.box,z,p.get("text-ignore-placement"),l.bucketInstanceId,Zt&&Zt.box&&ir?ir:ut,B.ID),Ne&&Ai&&this.collisionIndex.insertCollisionBox(Ai.box,J,p.get("icon-ignore-placement"),l.bucketInstanceId,rr,B.ID),Et&&(je&&this.collisionIndex.insertCollisionCircles(Et.circles,z,p.get("text-ignore-placement"),l.bucketInstanceId,ut,B.ID),n)){const Kt=l.bucketInstanceId;let Gt=this.collisionCircleArrays[Kt];Gt===void 0&&(Gt=this.collisionCircleArrays[Kt]=new ae);for(let si=0;si<Et.circles.length;si+=4)Gt.circles.push(Et.circles[si+0]),Gt.circles.push(Et.circles[si+1]),Gt.circles.push(Et.circles[si+2]),Gt.circles.push(Et.collisionDetected?1:0)}if(_e.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[_e.crossTileID]=new se(je||he,Ne||ce,Ze||l.justReloaded),s[_e.crossTileID]=!0};if(ne){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const _e=l.getSortedSymbolIndexes(this.transform.angle);for(let Le=_e.length-1;Le>=0;--Le){const Me=_e[Le];qe(l.symbolInstances.get(Me),l.collisionArrays[Me])}}else for(let _e=t.symbolInstanceStart;_e<t.symbolInstanceEnd;_e++)qe(l.symbolInstances.get(_e),l.collisionArrays[_e]);if(n&&l.bucketInstanceId in this.collisionCircleArrays){const _e=this.collisionCircleArrays[l.bucketInstanceId];c.as(_e.invProjMatrix,m),_e.viewportMatrix=this.collisionIndex.getViewportMatrix()}l.justReloaded=!1}markUsedJustification(t,s,n,l){let p;p=l===c.ai.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[c.at(s)];const m=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const g of m)g>=0&&(t.text.placedSymbolArray.get(g).crossTileID=p>=0&&g!==p?0:n.crossTileID)}markUsedOrientation(t,s,n){const l=s===c.ai.horizontal||s===c.ai.horizontalOnly?s:0,p=s===c.ai.vertical?s:0,m=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const g of m)t.text.placedSymbolArray.get(g).placedOrientation=l;n.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let n=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const l=s?s.symbolFadeChange(t):1,p=s?s.opacities:{},m=s?s.variableOffsets:{},g=s?s.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],w=p[y];w?(this.opacities[y]=new W(w,l,v.text,v.icon),n=n||v.text!==w.text.placed||v.icon!==w.icon.placed):(this.opacities[y]=new W(null,l,v.text,v.icon,v.skipFade),n=n||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const w=new W(v,l,!1,!1);w.isHidden()||(this.opacities[y]=w,n=n||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:t)}updateLayerOpacities(t,s){const n={};for(const l of s){const p=l.getBucket(t);p&&l.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,n,l.collisionBoxArray)}}updateBucketOpacities(t,s,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const l=t.layers[0],p=l.layout,m=new W(null,0,!1,!1,!0),g=p.get("text-allow-overlap"),y=p.get("icon-allow-overlap"),v=l._unevaluatedLayout.hasValue("text-variable-anchor")||l._unevaluatedLayout.hasValue("text-variable-anchor-offset"),w=p.get("text-rotation-alignment")==="map",S=p.get("text-pitch-alignment")==="map",E=p.get("icon-text-fit")!=="none",B=new W(null,0,g&&(y||!t.hasIconData()||p.get("icon-optional")),y&&(g||!t.hasTextData()||p.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const L=(F,z,G)=>{for(let J=0;J<z/4;J++)F.opacityVertexArray.emplaceBack(G);F.hasVisibleVertices=F.hasVisibleVertices||G!==Li};for(let F=0;F<t.symbolInstances.length;F++){const z=t.symbolInstances.get(F),{numHorizontalGlyphVertices:G,numVerticalGlyphVertices:J,crossTileID:U}=z;let X=this.opacities[U];s[U]?X=m:X||(X=B,this.opacities[U]=X),s[U]=!0;const ee=z.numIconVertices>0,te=this.placedOrientations[z.crossTileID],ne=te===c.ai.vertical,he=te===c.ai.horizontal||te===c.ai.horizontalOnly;if(G>0||J>0){const ce=jt(X.text);L(t.text,G,ne?Li:ce),L(t.text,J,he?Li:ce);const pe=X.text.isHidden();[z.rightJustifiedTextSymbolIndex,z.centerJustifiedTextSymbolIndex,z.leftJustifiedTextSymbolIndex].forEach(_e=>{_e>=0&&(t.text.placedSymbolArray.get(_e).hidden=pe||ne?1:0)}),z.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(z.verticalPlacedTextSymbolIndex).hidden=pe||he?1:0);const Ie=this.variableOffsets[z.crossTileID];Ie&&this.markUsedJustification(t,Ie.anchor,z,te);const qe=this.placedOrientations[z.crossTileID];qe&&(this.markUsedJustification(t,"left",z,qe),this.markUsedOrientation(t,qe,z))}if(ee){const ce=jt(X.icon),pe=!(E&&z.verticalPlacedIconSymbolIndex&&ne);z.placedIconSymbolIndex>=0&&(L(t.icon,z.numIconVertices,pe?ce:Li),t.icon.placedSymbolArray.get(z.placedIconSymbolIndex).hidden=X.icon.isHidden()),z.verticalPlacedIconSymbolIndex>=0&&(L(t.icon,z.numVerticalIconVertices,pe?Li:ce),t.icon.placedSymbolArray.get(z.verticalPlacedIconSymbolIndex).hidden=X.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ce=t.collisionArrays[F];if(ce){let pe=new c.P(0,0);if(ce.textBox||ce.verticalTextBox){let qe=!0;if(v){const _e=this.variableOffsets[U];_e?(pe=Re(_e.anchor,_e.width,_e.height,_e.textOffset,_e.textBoxScale),w&&pe._rotate(S?this.transform.angle:-this.transform.angle)):qe=!1}ce.textBox&&Oe(t.textCollisionBox.collisionVertexArray,X.text.placed,!qe||ne,pe.x,pe.y),ce.verticalTextBox&&Oe(t.textCollisionBox.collisionVertexArray,X.text.placed,!qe||he,pe.x,pe.y)}const Ie=!!(!he&&ce.verticalIconBox);ce.iconBox&&Oe(t.iconCollisionBox.collisionVertexArray,X.icon.placed,Ie,E?pe.x:0,E?pe.y:0),ce.verticalIconBox&&Oe(t.iconCollisionBox.collisionVertexArray,X.icon.placed,!Ie,E?pe.x:0,E?pe.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const F=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=F.invProjMatrix,t.placementViewportMatrix=F.viewportMatrix,t.collisionCircleArray=F.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,s){const n=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*n>t}setStale(){this.stale=!0}}function Oe(h,t,s,n,l){h.emplaceBack(t?1:0,s?1:0,n||0,l||0),h.emplaceBack(t?1:0,s?1:0,n||0,l||0),h.emplaceBack(t?1:0,s?1:0,n||0,l||0),h.emplaceBack(t?1:0,s?1:0,n||0,l||0)}const tt=Math.pow(2,25),st=Math.pow(2,24),Ke=Math.pow(2,17),He=Math.pow(2,16),Wt=Math.pow(2,9),ot=Math.pow(2,8),kt=Math.pow(2,1);function jt(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,s=Math.floor(127*h.opacity);return s*tt+t*st+s*Ke+t*He+s*Wt+t*ot+s*kt+t}const Li=0;class po{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,s,n,l,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(s.getBucketParts(m,l,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((g,y)=>g.sortKey-y.sortKey));this._currentPartIndex<m.length;)if(s.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,p())return!0;return!1}}class vs{constructor(t,s,n,l,p,m,g,y){this.placement=new ze(t,s,m,g,y),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,s,n){const l=c.h.now(),p=()=>!this._forceFullPlacement&&c.h.now()-l>2;for(;this._currentPlacementIndex>=0;){const m=s[t[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new po(m)),this._inProgressLayer.continuePlacement(n[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const bs=512/c.N/2;class bl{constructor(t,s,n){this.tileID=t,this.bucketInstanceId=n,this._symbolsByKey={};const l=new Map;for(let p=0;p<s.length;p++){const m=s.get(p),g=m.key,y=l.get(g);y?y.push(m):l.set(g,[m])}for(const[p,m]of l){const g={positions:m.map(y=>({x:Math.floor(y.anchorX*bs),y:Math.floor(y.anchorY*bs)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){const y=new c.av(g.positions.length,16,Uint16Array);for(const{x:v,y:w}of g.positions)y.add(v,w);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[p]=g}}getScaledCoordinates(t,s){const{x:n,y:l,z:p}=this.tileID.canonical,{x:m,y:g,z:y}=s.canonical,v=bs/Math.pow(2,y-p),w=(g*c.N+t.anchorY)*v,S=l*c.N*bs;return{x:Math.floor((m*c.N+t.anchorX)*v-n*c.N*bs),y:Math.floor(w-S)}}findMatches(t,s,n){const l=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const g=this._symbolsByKey[m.key];if(!g)continue;const y=this.getScaledCoordinates(m,s);if(g.index){const v=g.index.range(y.x-l,y.y-l,y.x+l,y.y+l).sort();for(const w of v){const S=g.crossTileIDs[w];if(!n[S]){n[S]=!0,m.crossTileID=S;break}}}else if(g.positions)for(let v=0;v<g.positions.length;v++){const w=g.positions[v],S=g.crossTileIDs[v];if(Math.abs(w.x-y.x)<=l&&Math.abs(w.y-y.y)<=l&&!n[S]){n[S]=!0,m.crossTileID=S;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class it{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class nn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const s=Math.round((t-this.lng)/360);if(s!==0)for(const n in this.indexes){const l=this.indexes[n],p={};for(const m in l){const g=l[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+s),p[g.tileID.key]=g}this.indexes[n]=p}this.lng=t}addBucket(t,s,n){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<s.symbolInstances.length;p++)s.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const l=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(t)&&y.findMatches(s.symbolInstances,t,l)}else{const g=m[t.scaledTo(Number(p)).key];g&&g.findMatches(s.symbolInstances,t,l)}}for(let p=0;p<s.symbolInstances.length;p++){const m=s.symbolInstances.get(p);m.crossTileID||(m.crossTileID=n.generate(),l[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new bl(t,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(t,s){for(const n of s.getCrossTileIDsLists())for(const l of n)delete this.usedCrossTileIDs[t][l]}removeStaleBuckets(t){let s=!1;for(const n in this.indexes){const l=this.indexes[n];for(const p in l)t[l[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,l[p]),delete l[p],s=!0)}return s}}class xa{constructor(){this.layerIndexes={},this.crossTileIDs=new it,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,s,n){let l=this.layerIndexes[t.id];l===void 0&&(l=this.layerIndexes[t.id]=new nn);let p=!1;const m={};l.handleWrapJump(n);for(const g of s){const y=g.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(g.tileID,y,this.crossTileIDs)&&(p=!0),m[y.bucketInstanceId]=!0)}return l.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const s={};t.forEach(n=>{s[n]=!0});for(const n in this.layerIndexes)s[n]||delete this.layerIndexes[n]}}const Ht=(h,t)=>c.x(h,t&&t.filter(s=>s.identifier!=="source.canvas")),bi=c.F(c.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),wl=c.F(c.ax,["setCenter","setZoom","setBearing","setPitch"]),Bi=c.aw();class qt extends c.E{constructor(t,s={}){super(),this.map=t,this.dispatcher=new Zs(ya(),this,t._getMapId()),this.imageManager=new $i,this.imageManager.setEventedParent(this),this.glyphManager=new hr(t._requestManager,s.localIdeographFontFamily),this.lineAtlas=new _a(256,512),this.crossTileSymbolIndex=new xa,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.az());const n=this;this._rtlTextPluginCallback=qt.registerForPluginStateChange(l=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:l.pluginStatus,pluginURL:l.pluginURL},(p,m)=>{if(c.aA(p),m&&m.every(g=>g))for(const g in n.sourceCaches){const y=n.sourceCaches[g].getSource().type;y!=="vector"&&y!=="geojson"||n.sourceCaches[g].reload()}})}),this.on("data",l=>{if(l.dataType!=="source"||l.sourceDataType!=="metadata")return;const p=this.sourceCaches[l.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,s={},n){this.fire(new c.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const l=this.map._requestManager.transformRequest(t,Pt.Style);this._request=c.f(l,(p,m)=>{this._request=null,p?this.fire(new c.j(p)):m&&this._load(m,s,n)})}loadJSON(t,s={},n){this.fire(new c.k("dataloading",{dataType:"style"})),this._request=c.h.frame(()=>{this._request=null,s.validate=s.validate!==!1,this._load(t,s,n)})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Bi,{validate:!1})}_load(t,s,n){var l;const p=s.transformStyle?s.transformStyle(n,t):t;if(!s.validate||!Ht(this,c.y(p))){this._loaded=!0,this.stylesheet=p;for(const m in p.sources)this.addSource(m,p.sources[m],{validate:!1});p.sprite?this._loadSprite(p.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(p.glyphs),this._createLayers(),this.light=new qs(this.stylesheet.light),this.map.setTerrain((l=this.stylesheet.terrain)!==null&&l!==void 0?l:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const t=c.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(s=>s.id),this._layers={},this._serializedLayers=null;for(const s of t){const n=c.aC(s);n.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=n}}_loadSprite(t,s=!1,n=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(l,p,m,g){const y=$t(l),v=y.length,w=m>1?"@2x":"",S={},E={},B={};for(const{id:L,url:F}of y){const z=p.transformRequest(p.normalizeSpriteURL(F,w,".json"),Pt.SpriteJSON),G=`${L}_${z.url}`;S[G]=c.f(z,(X,ee)=>{delete S[G],E[L]=ee,ga(g,E,B,X,v)});const J=p.transformRequest(p.normalizeSpriteURL(F,w,".png"),Pt.SpriteImage),U=`${L}_${J.url}`;S[U]=ei.getImage(J,(X,ee)=>{delete S[U],B[L]=ee,ga(g,E,B,X,v)})}return{cancel(){for(const L of Object.values(S))L.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(l,p)=>{if(this._spriteRequest=null,l)this.fire(new c.j(l));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in p)):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in p[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,p[m][y],!1):this.imageManager.addImage(v,p[m][y]),s&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),n&&n(l)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(t){const s=this.sourceCaches[t.source];if(!s)return;const n=t.sourceLayer;if(!n)return;const l=s.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(n)===-1)&&this.fire(new c.j(new Error(`Source layer "${n}" does not exist on source "${l.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const s=this._serializedAllLayers();if(!t||t.length===0)return Object.values(s);const n=[];for(const l of t)s[l]&&n.push(s[l]);return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const s=Object.keys(this._layers);for(const n of s){const l=this._layers[n];l.type!=="custom"&&(t[n]=l.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const s=this._changed;if(this._changed){const l=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(l.length||p.length)&&this._updateWorkerLayers(l,p);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const n={};for(const l in this.sourceCaches){const p=this.sourceCaches[l];n[l]=p.used,p.used=!1}for(const l of this._order){const p=this._layers[l];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const l in n){const p=this.sourceCaches[l];n[l]!==p.used&&p.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(t),this.z=t.zoom,s&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,s){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,s={}){this._checkLoaded();const n=this.serialize();if(t=s.transformStyle?s.transformStyle(n,t):t,Ht(this,c.y(t)))return!1;(t=c.aD(t)).layers=c.aB(t.layers);const l=c.aE(n,t).filter(m=>!(m.command in wl));if(l.length===0)return!1;const p=l.filter(m=>!(m.command in bi));if(p.length>0)throw new Error(`Unimplemented: ${p.map(m=>m.command).join(", ")}.`);for(const m of l)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,this._serializedLayers=null,!0}addImage(t,s){if(this.getImage(t))return this.fire(new c.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,s),this._afterImageUpdated(t)}updateImage(t,s){this.imageManager.updateImage(t,s)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,s,n={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(c.y.source,`sources.${t}`,s,null,n))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const l=this.sourceCaches[t]=new ui(t,s,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:t})),l.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new c.j(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));const s=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],s.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,s){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const n=this.sourceCaches[t].getSource();if(n.type!=="geojson")throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(s),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,s,n={}){this._checkLoaded();const l=t.id;if(this.getLayer(l))return void this.fire(new c.j(new Error(`Layer "${l}" already exists on this map.`)));let p;if(t.type==="custom"){if(Ht(this,c.aF(t)))return;p=c.aC(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(l,t.source),t=c.aD(t),t=c.e(t,{source:l})),this._validate(c.y.layer,`layers.${l}`,t,{arrayIndex:-1},n))return;p=c.aC(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:l}})}const m=s?this._order.indexOf(s):this._order.length;if(s&&m===-1)this.fire(new c.j(new Error(`Cannot add layer "${l}" before non-existing layer "${s}".`)));else{if(this._order.splice(m,0,l),this._layerOrderChanged=!0,this._layers[l]=p,this._removedLayers[l]&&p.source&&p.type!=="custom"){const g=this._removedLayers[l];delete this._removedLayers[l],g.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,s){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===s)return;const n=this._order.indexOf(t);this._order.splice(n,1);const l=s?this._order.indexOf(s):this._order.length;s&&l===-1?this.fire(new c.j(new Error(`Cannot move layer "${t}" before non-existing layer "${s}".`))):(this._order.splice(l,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const s=this._layers[t];if(!s)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${t}".`)));s.setEventedParent(null);const n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=s,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],s.onRemove&&s.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,s,n){this._checkLoaded();const l=this.getLayer(t);l?l.minzoom===s&&l.maxzoom===n||(s!=null&&(l.minzoom=s),n!=null&&(l.maxzoom=n),this._updateLayer(l)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,s,n={}){this._checkLoaded();const l=this.getLayer(t);if(l){if(!c.aG(l.filter,s))return s==null?(l.filter=void 0,void this._updateLayer(l)):void(this._validate(c.y.filter,`layers.${l.id}.filter`,s,null,n)||(l.filter=c.aD(s),this._updateLayer(l)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.aD(this.getLayer(t).filter)}setLayoutProperty(t,s,n,l={}){this._checkLoaded();const p=this.getLayer(t);p?c.aG(p.getLayoutProperty(s),n)||(p.setLayoutProperty(s,n,l),this._updateLayer(p)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,s){const n=this.getLayer(t);if(n)return n.getLayoutProperty(s);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,s,n,l={}){this._checkLoaded();const p=this.getLayer(t);p?c.aG(p.getPaintProperty(s),n)||(p.setPaintProperty(s,n,l)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,s){return this.getLayer(t).getPaintProperty(s)}setFeatureState(t,s){this._checkLoaded();const n=t.source,l=t.sourceLayer,p=this.sourceCaches[n];if(p===void 0)return void this.fire(new c.j(new Error(`The source '${n}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&l?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||l?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),p.setFeatureState(l,t.id,s)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,s){this._checkLoaded();const n=t.source,l=this.sourceCaches[n];if(l===void 0)return void this.fire(new c.j(new Error(`The source '${n}' does not exist in the map's style.`)));const p=l.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?s&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(m,t.id,s):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const s=t.source,n=t.sourceLayer,l=this.sourceCaches[s];if(l!==void 0)return l.getSource().type!=="vector"||n?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),l.getFeatureState(n,t.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${s}' 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 t=c.aH(this.sourceCaches,p=>p.serialize()),s=this._serializeByIds(this._order),n=this.map.getTerrain()||void 0,l=this.stylesheet;return c.aI({version:l.version,name:l.name,metadata:l.metadata,light:l.light,center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,sprite:l.sprite,glyphs:l.glyphs,transition:l.transition,sources:t,layers:s,terrain:n},p=>p!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const s=m=>this._layers[m].type==="fill-extrusion",n={},l=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g)){n[g]=m;for(const y of t){const v=y[g];if(v)for(const w of v)l.push(w)}}}l.sort((m,g)=>g.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g))for(let y=l.length-1;y>=0;y--){const v=l[y].feature;if(n[v.layer.id]<m)break;p.push(v),l.pop()}else for(const y of t){const v=y[g];if(v)for(const w of v)p.push(w.feature)}}return p}queryRenderedFeatures(t,s,n){s&&s.filter&&this._validate(c.y.filter,"queryRenderedFeatures.filter",s.filter,null,s);const l={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new c.j(new Error("parameters.layers must be an Array."))),[];for(const g of s.layers){const y=this._layers[g];if(!y)return this.fire(new c.j(new Error(`The layer '${g}' does not exist in the map's style and cannot be queried for features.`))),[];l[y.source]=!0}}const p=[];s.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const g in this.sourceCaches)s.layers&&!l[g]||p.push(Zr(this.sourceCaches[g],this._layers,m,t,s,n));return this.placement&&p.push(function(g,y,v,w,S,E,B){const L={},F=E.queryRenderedSymbols(w),z=[];for(const G of Object.keys(F).map(Number))z.push(B[G]);z.sort(Cr);for(const G of z){const J=G.featureIndex.lookupSymbolFeatures(F[G.bucketInstanceId],y,G.bucketIndex,G.sourceLayerIndex,S.filter,S.layers,S.availableImages,g);for(const U in J){const X=L[U]=L[U]||[],ee=J[U];ee.sort((te,ne)=>{const he=G.featureSortOrder;if(he){const ce=he.indexOf(te.featureIndex);return he.indexOf(ne.featureIndex)-ce}return ne.featureIndex-te.featureIndex});for(const te of ee)X.push(te)}}for(const G in L)L[G].forEach(J=>{const U=J.feature,X=v[g[G].source].getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=X});return L}(this._layers,m,this.sourceCaches,t,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,s){s&&s.filter&&this._validate(c.y.filter,"querySourceFeatures.filter",s.filter,null,s);const n=this.sourceCaches[t];return n?function(l,p){const m=l.getRenderableIds().map(v=>l.getTileByID(v)),g=[],y={};for(let v=0;v<m.length;v++){const w=m[v],S=w.tileID.canonical.key;y[S]||(y[S]=!0,w.querySourceFeatures(g,p))}return g}(n,s):[]}addSourceType(t,s,n){return ur(t)?n(new Error(`A source type called "${t}" already exists.`)):(((l,p)=>{Xs[l]=p})(t,s),s.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:s.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(t,s={}){this._checkLoaded();const n=this.light.getLight();let l=!1;for(const m in t)if(!c.aG(t[m],n[m])){l=!0;break}if(!l)return;const p={now:c.h.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,s),this.light.updateTransitions(p)}_validate(t,s,n,l,p={}){return(!p||p.validate!==!1)&&Ht(this,t.call(c.y,c.e({key:s,style:this.serialize(),value:n,styleSpec:c.v},l)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this.sourceCaches){const n=this.sourceCaches[s];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const s in this.sourceCaches)this.sourceCaches[s].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,s,n,l,p=!1){let m=!1,g=!1;const y={};for(const v of this._order){const w=this._layers[v];if(w.type!=="symbol")continue;if(!y[w.source]){const E=this.sourceCaches[w.source];y[w.source]=E.getRenderableIds(!0).map(B=>E.getTileByID(B)).sort((B,L)=>L.tileID.overscaledZ-B.tileID.overscaledZ||(B.tileID.isLessThan(L.tileID)?-1:1))}const S=this.crossTileSymbolIndex.addLayer(w,y[w.source],t.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||n===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.h.now(),t.zoom))&&(this.pauseablePlacement=new vs(t,this.map.terrain,this._order,p,s,n,l,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(c.h.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)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(c.h.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,s,n){this.imageManager.getImages(s.icons,n),this._updateTilesForChangedImages();const l=this.sourceCaches[s.source];l&&l.setDependencies(s.tileID.key,s.type,s.icons)}getGlyphs(t,s,n){this.glyphManager.getGlyphs(s.stacks,n);const l=this.sourceCaches[s.source];l&&l.setDependencies(s.tileID.key,s.type,[""])}getResource(t,s,n){return c.m(s,n)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,s={}){this._checkLoaded(),t&&this._validate(c.y.glyphs,"glyphs",t,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,s,n={},l){this._checkLoaded();const p=[{id:t,url:s}],m=[...$t(this.stylesheet.sprite),...p];this._validate(c.y.sprite,"sprite",m,null,n)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,l))}removeSprite(t){this._checkLoaded();const s=$t(this.stylesheet.sprite);if(s.find(n=>n.id===t)){if(this._spritesImagesIds[t])for(const n of this._spritesImagesIds[t])this.imageManager.removeImage(n),this._changedImages[n]=!0;s.splice(s.findIndex(n=>n.id===t),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return $t(this.stylesheet.sprite)}setSprite(t,s={},n){this._checkLoaded(),t&&this._validate(c.y.sprite,"sprite",t,null,s)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,n):(this._unloadSprite(),n&&n(null)))}}qt.registerForPluginStateChange=c.aK;var va=c.Q([{name:"a_pos",type:"Int16",components:2}]),ws="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const gt={prelude:Je(`#ifdef GL_ES
|
|
3
3
|
precision mediump float;
|
|
4
4
|
#else
|
|
@@ -577,5 +577,5 @@ uniform ${w} ${S} u_${E};
|
|
|
577
577
|
`),U=g.createShader(g.FRAGMENT_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(U,G),g.compileShader(U),!g.getShaderParameter(U,g.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${g.getShaderInfoLog(U)}`);g.attachShader(this.program,U);const X=g.createShader(g.VERTEX_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(X,J),g.compileShader(X),!g.getShaderParameter(X,g.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${g.getShaderInfoLog(X)}`);g.attachShader(this.program,X),this.attributes={};const ee={};this.numAttributes=w.length;for(let te=0;te<this.numAttributes;te++)w[te]&&(g.bindAttribLocation(this.program,te,w[te]),this.attributes[w[te]]=te);if(g.linkProgram(this.program),!g.getProgramParameter(this.program,g.LINK_STATUS))throw new Error(`Program failed to link: ${g.getProgramInfoLog(this.program)}`);g.deleteShader(X),g.deleteShader(U);for(let te=0;te<F.length;te++){const ne=F[te];if(ne&&!ee[ne]){const he=g.getUniformLocation(this.program,ne);he&&(ee[ne]=he)}}this.fixedUniforms=l(t,ee),this.terrainUniforms=((te,ne)=>({u_depth:new c.aL(te,ne.u_depth),u_terrain:new c.aL(te,ne.u_terrain),u_terrain_dim:new c.aM(te,ne.u_terrain_dim),u_terrain_matrix:new c.aN(te,ne.u_terrain_matrix),u_terrain_unpack:new c.aO(te,ne.u_terrain_unpack),u_terrain_exaggeration:new c.aM(te,ne.u_terrain_exaggeration)}))(t,ee),this.binderUniforms=n?n.getUniforms(t,ee):[]}draw(t,s,n,l,p,m,g,y,v,w,S,E,B,L,F,z,G,J){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(l),t.setColorMode(p),t.setCullFace(m),y){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,y.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,y.texture);for(const ee in this.terrainUniforms)this.terrainUniforms[ee].set(y[ee])}for(const ee in this.fixedUniforms)this.fixedUniforms[ee].set(g[ee]);F&&F.setUniforms(t,this.binderUniforms,B,{zoom:L});let X=0;switch(s){case U.LINES:X=2;break;case U.TRIANGLES:X=3;break;case U.LINE_STRIP:X=1}for(const ee of E.get()){const te=ee.vaos||(ee.vaos={});(te[v]||(te[v]=new Hr)).bind(t,this,w,F?F.getPaintVertexBuffers():[],S,ee.vertexOffset,z,G,J),U.drawElements(s,ee.primitiveLength*X,U.UNSIGNED_SHORT,ee.primitiveOffset*X*2)}}}function Ri(h,t,s){const n=1/Z(s,1,t.transform.tileZoom),l=Math.pow(2,s.tileID.overscaledZ),p=s.tileSize*Math.pow(2,t.transform.tileZoom)/l,m=p*(s.tileID.canonical.x+s.tileID.wrap*l),g=p*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[n,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const on=(h,t,s,n)=>{const l=t.style.light,p=l.properties.get("position"),m=[p.x,p.y,p.z],g=function(){var v=new c.A(9);return c.A!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();l.properties.get("anchor")==="viewport"&&function(v,w){var S=Math.sin(w),E=Math.cos(w);v[0]=E,v[1]=S,v[2]=0,v[3]=-S,v[4]=E,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(g,-t.transform.angle),function(v,w,S){var E=w[0],B=w[1],L=w[2];v[0]=E*S[0]+B*S[3]+L*S[6],v[1]=E*S[1]+B*S[4]+L*S[7],v[2]=E*S[2]+B*S[5]+L*S[8]}(m,m,g);const y=l.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+s,u_opacity:n}},zr=(h,t,s,n,l,p,m)=>c.e(on(h,t,s,n),Ri(p,t,m),{u_height_factor:-Math.pow(2,l.overscaledZ)/m.tileSize/8}),fo=h=>({u_matrix:h}),ln=(h,t,s,n)=>c.e(fo(h),Ri(s,t,n)),wa=(h,t)=>({u_matrix:h,u_world:t}),Sa=(h,t,s,n,l)=>c.e(ln(h,t,s,n),{u_world:l}),Dr=(h,t,s,n)=>{const l=h.transform;let p,m;if(n.paint.get("circle-pitch-alignment")==="map"){const g=Z(s,1,l.zoom);p=!0,m=[g,g]}else p=!1,m=l.pixelsToGLUnits;return{u_camera_to_center_distance:l.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,s,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},cn=(h,t,s)=>{const n=Z(s,1,t.zoom),l=Math.pow(2,t.zoom-s.tileID.overscaledZ),p=s.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[t.pixelsToGLUnits[0]/(n*l),t.pixelsToGLUnits[1]/(n*l)],u_overscale_factor:p}},Ws=(h,t,s=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:s}),mo=h=>({u_matrix:h}),Sl=(h,t,s,n)=>({u_matrix:h,u_extrude_scale:Z(t,1,s),u_intensity:n});function hn(h,t){const s=Math.pow(2,t.canonical.z),n=t.canonical.y;return[new c.U(0,n/s).toLngLat().lat,new c.U(0,(n+1)/s).toLngLat().lat]}const un=(h,t,s,n)=>{const l=h.transform;return{u_matrix:Ta(h,t,s,n),u_ratio:1/Z(t,1,l.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},go=(h,t,s,n,l)=>c.e(un(h,t,s,l),{u_image:0,u_image_height:n}),Tl=(h,t,s,n,l)=>{const p=h.transform,m=yo(t,p);return{u_matrix:Ta(h,t,s,l),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Z(t,1,p.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},_o=(h,t,s,n,l,p)=>{const m=h.lineAtlas,g=yo(t,h.transform),y=s.layout.get("line-cap")==="round",v=m.getDash(n.from,y),w=m.getDash(n.to,y),S=v.width*l.fromScale,E=w.width*l.toScale;return c.e(un(h,t,s,p),{u_patternscale_a:[g/S,-v.height/2],u_patternscale_b:[g/E,-w.height/2],u_sdfgamma:m.width/(256*Math.min(S,E)*h.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:w.y,u_mix:l.t})};function yo(h,t){return 1/Z(h,1,t.tileZoom)}function Ta(h,t,s,n){return h.translatePosMatrix(n?n.posMatrix:t.tileID.posMatrix,t,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const xo=(h,t,s,n,l)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:s,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(m=l.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=l.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:vo(l.paint.get("raster-hue-rotate"))};var p,m};function vo(h){h*=Math.PI/180;const t=Math.sin(h),s=Math.cos(h);return[(2*s+1)/3,(-Math.sqrt(3)*t-s+1)/3,(Math.sqrt(3)*t-s+1)/3]}const pn=(h,t,s,n,l,p,m,g,y,v)=>{const w=l.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:w.cameraToCenterDistance,u_pitch:w.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:w.width/w.height,u_fade_change:l.options.fadeDuration?l.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+y,u_pitch_with_map:+n,u_texsize:v,u_texture:0}},dn=(h,t,s,n,l,p,m,g,y,v,w)=>{const S=l.transform;return c.e(pn(h,t,s,n,l,p,m,g,y,v),{u_gamma_scale:n?Math.cos(S._pitch)*S.cameraToCenterDistance:1,u_device_pixel_ratio:l.pixelRatio,u_is_halo:+w})},Kr=(h,t,s,n,l,p,m,g,y,v)=>c.e(dn(h,t,s,n,l,p,m,g,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Ia=(h,t,s)=>({u_matrix:h,u_opacity:t,u_color:s}),Fi=(h,t,s,n,l,p)=>c.e(function(m,g,y,v){const w=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:E,height:B}=y.imageManager.getPixelSize(),L=Math.pow(2,v.tileID.overscaledZ),F=v.tileSize*Math.pow(2,y.transform.tileZoom)/L,z=F*(v.tileID.canonical.x+v.tileID.wrap*L),G=F*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:w.tl,u_pattern_br_a:w.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[E,B],u_mix:g.t,u_pattern_size_a:w.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/Z(v,1,y.transform.tileZoom),u_pixel_coord_upper:[z>>16,G>>16],u_pixel_coord_lower:[65535&z,65535&G]}}(n,p,s,l),{u_matrix:h,u_opacity:t}),Aa={fillExtrusion:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_lightpos:new c.aP(h,t.u_lightpos),u_lightintensity:new c.aM(h,t.u_lightintensity),u_lightcolor:new c.aP(h,t.u_lightcolor),u_vertical_gradient:new c.aM(h,t.u_vertical_gradient),u_opacity:new c.aM(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_lightpos:new c.aP(h,t.u_lightpos),u_lightintensity:new c.aM(h,t.u_lightintensity),u_lightcolor:new c.aP(h,t.u_lightcolor),u_vertical_gradient:new c.aM(h,t.u_vertical_gradient),u_height_factor:new c.aM(h,t.u_height_factor),u_image:new c.aL(h,t.u_image),u_texsize:new c.aQ(h,t.u_texsize),u_pixel_coord_upper:new c.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(h,t.u_pixel_coord_lower),u_scale:new c.aP(h,t.u_scale),u_fade:new c.aM(h,t.u_fade),u_opacity:new c.aM(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_image:new c.aL(h,t.u_image),u_texsize:new c.aQ(h,t.u_texsize),u_pixel_coord_upper:new c.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(h,t.u_pixel_coord_lower),u_scale:new c.aP(h,t.u_scale),u_fade:new c.aM(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_world:new c.aQ(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_world:new c.aQ(h,t.u_world),u_image:new c.aL(h,t.u_image),u_texsize:new c.aQ(h,t.u_texsize),u_pixel_coord_upper:new c.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(h,t.u_pixel_coord_lower),u_scale:new c.aP(h,t.u_scale),u_fade:new c.aM(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_scale_with_map:new c.aL(h,t.u_scale_with_map),u_pitch_with_map:new c.aL(h,t.u_pitch_with_map),u_extrude_scale:new c.aQ(h,t.u_extrude_scale),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_matrix:new c.aN(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aM(h,t.u_pixels_to_tile_units),u_extrude_scale:new c.aQ(h,t.u_extrude_scale),u_overscale_factor:new c.aM(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_inv_matrix:new c.aN(h,t.u_inv_matrix),u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_viewport_size:new c.aQ(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new c.aR(h,t.u_color),u_matrix:new c.aN(h,t.u_matrix),u_overlay:new c.aL(h,t.u_overlay),u_overlay_scale:new c.aM(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new c.aM(h,t.u_extrude_scale),u_intensity:new c.aM(h,t.u_intensity),u_matrix:new c.aN(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_world:new c.aQ(h,t.u_world),u_image:new c.aL(h,t.u_image),u_color_ramp:new c.aL(h,t.u_color_ramp),u_opacity:new c.aM(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_image:new c.aL(h,t.u_image),u_latrange:new c.aQ(h,t.u_latrange),u_light:new c.aQ(h,t.u_light),u_shadow:new c.aR(h,t.u_shadow),u_highlight:new c.aR(h,t.u_highlight),u_accent:new c.aR(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_image:new c.aL(h,t.u_image),u_dimension:new c.aQ(h,t.u_dimension),u_zoom:new c.aM(h,t.u_zoom),u_unpack:new c.aO(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_ratio:new c.aM(h,t.u_ratio),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_ratio:new c.aM(h,t.u_ratio),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(h,t.u_units_to_pixels),u_image:new c.aL(h,t.u_image),u_image_height:new c.aM(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_texsize:new c.aQ(h,t.u_texsize),u_ratio:new c.aM(h,t.u_ratio),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_image:new c.aL(h,t.u_image),u_units_to_pixels:new c.aQ(h,t.u_units_to_pixels),u_scale:new c.aP(h,t.u_scale),u_fade:new c.aM(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_ratio:new c.aM(h,t.u_ratio),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(h,t.u_units_to_pixels),u_patternscale_a:new c.aQ(h,t.u_patternscale_a),u_patternscale_b:new c.aQ(h,t.u_patternscale_b),u_sdfgamma:new c.aM(h,t.u_sdfgamma),u_image:new c.aL(h,t.u_image),u_tex_y_a:new c.aM(h,t.u_tex_y_a),u_tex_y_b:new c.aM(h,t.u_tex_y_b),u_mix:new c.aM(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_tl_parent:new c.aQ(h,t.u_tl_parent),u_scale_parent:new c.aM(h,t.u_scale_parent),u_buffer_scale:new c.aM(h,t.u_buffer_scale),u_fade_t:new c.aM(h,t.u_fade_t),u_opacity:new c.aM(h,t.u_opacity),u_image0:new c.aL(h,t.u_image0),u_image1:new c.aL(h,t.u_image1),u_brightness_low:new c.aM(h,t.u_brightness_low),u_brightness_high:new c.aM(h,t.u_brightness_high),u_saturation_factor:new c.aM(h,t.u_saturation_factor),u_contrast_factor:new c.aM(h,t.u_contrast_factor),u_spin_weights:new c.aP(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new c.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(h,t.u_is_size_feature_constant),u_size_t:new c.aM(h,t.u_size_t),u_size:new c.aM(h,t.u_size),u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_pitch:new c.aM(h,t.u_pitch),u_rotate_symbol:new c.aL(h,t.u_rotate_symbol),u_aspect_ratio:new c.aM(h,t.u_aspect_ratio),u_fade_change:new c.aM(h,t.u_fade_change),u_matrix:new c.aN(h,t.u_matrix),u_label_plane_matrix:new c.aN(h,t.u_label_plane_matrix),u_coord_matrix:new c.aN(h,t.u_coord_matrix),u_is_text:new c.aL(h,t.u_is_text),u_pitch_with_map:new c.aL(h,t.u_pitch_with_map),u_texsize:new c.aQ(h,t.u_texsize),u_texture:new c.aL(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new c.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(h,t.u_is_size_feature_constant),u_size_t:new c.aM(h,t.u_size_t),u_size:new c.aM(h,t.u_size),u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_pitch:new c.aM(h,t.u_pitch),u_rotate_symbol:new c.aL(h,t.u_rotate_symbol),u_aspect_ratio:new c.aM(h,t.u_aspect_ratio),u_fade_change:new c.aM(h,t.u_fade_change),u_matrix:new c.aN(h,t.u_matrix),u_label_plane_matrix:new c.aN(h,t.u_label_plane_matrix),u_coord_matrix:new c.aN(h,t.u_coord_matrix),u_is_text:new c.aL(h,t.u_is_text),u_pitch_with_map:new c.aL(h,t.u_pitch_with_map),u_texsize:new c.aQ(h,t.u_texsize),u_texture:new c.aL(h,t.u_texture),u_gamma_scale:new c.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_is_halo:new c.aL(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new c.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(h,t.u_is_size_feature_constant),u_size_t:new c.aM(h,t.u_size_t),u_size:new c.aM(h,t.u_size),u_camera_to_center_distance:new c.aM(h,t.u_camera_to_center_distance),u_pitch:new c.aM(h,t.u_pitch),u_rotate_symbol:new c.aL(h,t.u_rotate_symbol),u_aspect_ratio:new c.aM(h,t.u_aspect_ratio),u_fade_change:new c.aM(h,t.u_fade_change),u_matrix:new c.aN(h,t.u_matrix),u_label_plane_matrix:new c.aN(h,t.u_label_plane_matrix),u_coord_matrix:new c.aN(h,t.u_coord_matrix),u_is_text:new c.aL(h,t.u_is_text),u_pitch_with_map:new c.aL(h,t.u_pitch_with_map),u_texsize:new c.aQ(h,t.u_texsize),u_texsize_icon:new c.aQ(h,t.u_texsize_icon),u_texture:new c.aL(h,t.u_texture),u_texture_icon:new c.aL(h,t.u_texture_icon),u_gamma_scale:new c.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new c.aM(h,t.u_device_pixel_ratio),u_is_halo:new c.aL(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_opacity:new c.aM(h,t.u_opacity),u_color:new c.aR(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_opacity:new c.aM(h,t.u_opacity),u_image:new c.aL(h,t.u_image),u_pattern_tl_a:new c.aQ(h,t.u_pattern_tl_a),u_pattern_br_a:new c.aQ(h,t.u_pattern_br_a),u_pattern_tl_b:new c.aQ(h,t.u_pattern_tl_b),u_pattern_br_b:new c.aQ(h,t.u_pattern_br_b),u_texsize:new c.aQ(h,t.u_texsize),u_mix:new c.aM(h,t.u_mix),u_pattern_size_a:new c.aQ(h,t.u_pattern_size_a),u_pattern_size_b:new c.aQ(h,t.u_pattern_size_b),u_scale_a:new c.aM(h,t.u_scale_a),u_scale_b:new c.aM(h,t.u_scale_b),u_pixel_coord_upper:new c.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aM(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_texture:new c.aL(h,t.u_texture),u_ele_delta:new c.aM(h,t.u_ele_delta)}),terrainDepth:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_ele_delta:new c.aM(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new c.aN(h,t.u_matrix),u_texture:new c.aL(h,t.u_texture),u_terrain_coords_id:new c.aM(h,t.u_terrain_coords_id),u_ele_delta:new c.aM(h,t.u_ele_delta)})};class Ma{constructor(t,s,n){this.context=t;const l=t.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Hs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(t,s,n,l){this.length=s.length,this.attributes=n,this.itemSize=s.bytesPerElement,this.dynamicDraw=l,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,s){for(let n=0;n<this.attributes.length;n++){const l=s.attributes[this.attributes[n].name];l!==void 0&&t.enableVertexAttribArray(l)}}setVertexAttribPointers(t,s,n){for(let l=0;l<this.attributes.length;l++){const p=this.attributes[l],m=s.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Hs[p.type]],!1,this.itemSize,p.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ss=new WeakMap;function Lr(h){var t;if(Ss.has(h))return Ss.get(h);{const s=(t=h.getParameter(h.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ss.set(h,s),s}}class Xe{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ca extends Xe{getDefault(){return c.aT.transparent}set(t){const s=this.current;(t.r!==s.r||t.g!==s.g||t.b!==s.b||t.a!==s.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class wi extends Xe{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Si extends Xe{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class fn extends Xe{getDefault(){return[!0,!0,!0,!0]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||t[3]!==s[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Pa extends Xe{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ka extends Xe{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class mn extends Xe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const s=this.current;(t.func!==s.func||t.ref!==s.ref||t.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class gn extends Xe{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class za extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=t,this.dirty=!1}}class _n extends Xe{getDefault(){return[0,1]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class yn extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=t,this.dirty=!1}}class Da extends Xe{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class bo extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.BLEND):s.disable(s.BLEND),this.current=t,this.dirty=!1}}class wo extends Xe{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ts extends Xe{getDefault(){return c.aT.transparent}set(t){const s=this.current;(t.r!==s.r||t.g!==s.g||t.b!==s.b||t.a!==s.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Il extends Xe{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Al extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=t,this.dirty=!1}}class Ml extends Xe{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class El extends Xe{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Cl extends Xe{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Pl extends Xe{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class xn extends Xe{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||t[3]!==s[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class La extends Xe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class vn extends Xe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class bn extends Xe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindTexture(s.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Is extends Xe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class So extends Xe{getDefault(){return null}set(t){const s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class To extends Xe{getDefault(){return null}set(t){var s;if(t===this.current&&!this.dirty)return;const n=this.gl;Lr(n)?n.bindVertexArray(t):(s=n.getExtension("OES_vertex_array_object"))===null||s===void 0||s.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class wn extends Xe{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Yr extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Io extends Xe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Br extends Xe{constructor(t,s){super(t),this.context=t,this.parent=s}getDefault(){return null}}class As extends Br{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ao extends Br{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Sn extends Br{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Qe{constructor(t,s,n,l,p){this.context=t,this.width=s,this.height=n;const m=t.gl,g=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new As(t,g),l)this.depthAttachment=p?new Sn(t,g):new Ao(t,g);else if(p)throw new Error("Stencil cannot be setted without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,s=this.colorAttachment.get();if(s&&t.deleteTexture(s),this.depthAttachment){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}t.deleteFramebuffer(this.framebuffer)}}class _t{constructor(t,s,n){this.blendFunction=t,this.blendColor=s,this.mask=n}}_t.Replace=[1,0],_t.disabled=new _t(_t.Replace,c.aT.transparent,[!1,!1,!1,!1]),_t.unblended=new _t(_t.Replace,c.aT.transparent,[!0,!0,!0,!0]),_t.alphaBlended=new _t([1,771],c.aT.transparent,[!0,!0,!0,!0]);class kl{constructor(t){var s,n;if(this.gl=t,this.clearColor=new Ca(this),this.clearDepth=new wi(this),this.clearStencil=new Si(this),this.colorMask=new fn(this),this.depthMask=new Pa(this),this.stencilMask=new ka(this),this.stencilFunc=new mn(this),this.stencilOp=new gn(this),this.stencilTest=new za(this),this.depthRange=new _n(this),this.depthTest=new yn(this),this.depthFunc=new Da(this),this.blend=new bo(this),this.blendFunc=new wo(this),this.blendColor=new Ts(this),this.blendEquation=new Il(this),this.cullFace=new Al(this),this.cullFaceSide=new Ml(this),this.frontFace=new El(this),this.program=new Cl(this),this.activeTexture=new Pl(this),this.viewport=new xn(this),this.bindFramebuffer=new La(this),this.bindRenderbuffer=new vn(this),this.bindTexture=new bn(this),this.bindVertexBuffer=new Is(this),this.bindElementBuffer=new So(this),this.bindVertexArray=new To(this),this.pixelStoreUnpack=new wn(this),this.pixelStoreUnpackPremultiplyAlpha=new Yr(this),this.pixelStoreUnpackFlipY=new Io(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Lr(t)){this.HALF_FLOAT=t.HALF_FLOAT;const l=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(s=t.RGBA16F)!==null&&s!==void 0?s:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(n=t.RGB16F)!==null&&n!==void 0?n:l==null?void 0:l.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const l=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.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(t,s){return new Ma(this,t,s)}createVertexBuffer(t,s,n){return new Ea(this,t,s,n)}createRenderbuffer(t,s,n){const l=this.gl,p=l.createRenderbuffer();return this.bindRenderbuffer.set(p),l.renderbufferStorage(l.RENDERBUFFER,t,s,n),this.bindRenderbuffer.set(null),p}createFramebuffer(t,s,n,l){return new Qe(this,t,s,n,l)}clear({color:t,depth:s,stencil:n}){const l=this.gl;let p=0;t&&(p|=l.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(p|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),n!==void 0&&(p|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),l.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){c.aG(t.blendFunction,_t.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Lr(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var s;return Lr(this.gl)?this.gl.deleteVertexArray(t):(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class We{constructor(t,s,n){this.func=t,this.mask=s,this.range=n}}We.ReadOnly=!1,We.ReadWrite=!0,We.disabled=new We(519,We.ReadOnly,[0,1]);const Jr=7680;class yt{constructor(t,s,n,l,p,m){this.test=t,this.ref=s,this.mask=n,this.fail=l,this.depthFail=p,this.pass=m}}yt.disabled=new yt({func:519,mask:0},0,0,Jr,Jr,Jr);class dt{constructor(t,s,n){this.enable=t,this.mode=s,this.frontFace=n}}let Ks;function Mo(h,t,s,n,l,p,m){const g=h.context,y=g.gl,v=h.useProgram("collisionBox"),w=[];let S=0,E=0;for(let U=0;U<n.length;U++){const X=n[U],ee=t.getTile(X),te=ee.getBucket(s);if(!te)continue;let ne=X.posMatrix;l[0]===0&&l[1]===0||(ne=h.translatePosMatrix(X.posMatrix,ee,l,p));const he=m?te.textCollisionBox:te.iconCollisionBox,ce=te.collisionCircleArray;if(ce.length>0){const pe=c.Z(),Ie=ne;c.aU(pe,te.placementInvProjMatrix,h.transform.glCoordMatrix),c.aU(pe,pe,te.placementViewportMatrix),w.push({circleArray:ce,circleOffset:E,transform:Ie,invTransform:pe,coord:X}),S+=ce.length/4,E=S}he&&v.draw(g,y.LINES,We.disabled,yt.disabled,h.colorModeForRenderPass(),dt.disabled,cn(ne,h.transform,ee),h.style.map.terrain&&h.style.map.terrain.getTerrainData(X),s.id,he.layoutVertexBuffer,he.indexBuffer,he.segments,null,h.transform.zoom,null,null,he.collisionVertexBuffer)}if(!m||!w.length)return;const B=h.useProgram("collisionCircle"),L=new c.aV;L.resize(4*S),L._trim();let F=0;for(const U of w)for(let X=0;X<U.circleArray.length/4;X++){const ee=4*X,te=U.circleArray[ee+0],ne=U.circleArray[ee+1],he=U.circleArray[ee+2],ce=U.circleArray[ee+3];L.emplace(F++,te,ne,he,ce,0),L.emplace(F++,te,ne,he,ce,1),L.emplace(F++,te,ne,he,ce,2),L.emplace(F++,te,ne,he,ce,3)}(!Ks||Ks.length<2*S)&&(Ks=function(U){const X=2*U,ee=new c.aX;ee.resize(X),ee._trim();for(let te=0;te<X;te++){const ne=6*te;ee.uint16[ne+0]=4*te+0,ee.uint16[ne+1]=4*te+1,ee.uint16[ne+2]=4*te+2,ee.uint16[ne+3]=4*te+2,ee.uint16[ne+4]=4*te+3,ee.uint16[ne+5]=4*te+0}return ee}(S));const z=g.createIndexBuffer(Ks,!0),G=g.createVertexBuffer(L,c.aW.members,!0);for(const U of w){const X={u_matrix:U.transform,u_inv_matrix:U.invTransform,u_camera_to_center_distance:(J=h.transform).cameraToCenterDistance,u_viewport_size:[J.width,J.height]};B.draw(g,y.TRIANGLES,We.disabled,yt.disabled,h.colorModeForRenderPass(),dt.disabled,X,h.style.map.terrain&&h.style.map.terrain.getTerrainData(U.coord),s.id,G,z,c.S.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,h.transform.zoom,null,null,null)}var J;G.destroy(),z.destroy()}dt.disabled=new dt(!1,1029,2305),dt.backCCW=new dt(!0,1029,2305);const Tn=c.ao(new Float32Array(16));function Ba(h,t,s,n,l,p){const{horizontalAlign:m,verticalAlign:g}=c.au(h);return new c.P((-(m-.5)*t/l+n[0])*p,(-(g-.5)*s/l+n[1])*p)}function Ra(h,t,s,n,l,p,m,g,y,v,w){const S=h.text.placedSymbolArray,E=h.text.dynamicLayoutVertexArray,B=h.icon.dynamicLayoutVertexArray,L={};E.clear();for(let F=0;F<S.length;F++){const z=S.get(F),G=z.hidden||!z.crossTileID||h.allowVerticalPlacement&&!z.placedOrientation?null:n[z.crossTileID];if(G){const J=new c.P(z.anchorX,z.anchorY),U=vt(J,s?m:p,w),X=Wr(l.cameraToCenterDistance,U.signedDistanceFromCamera);let ee=c.aj(h.textSizeData,y,z)*X/c.ap;s&&(ee*=h.tilePixelRatio/g);const{width:te,height:ne,anchor:he,textOffset:ce,textBoxScale:pe}=G,Ie=Ba(he,te,ne,ce,pe,ee),qe=s?vt(J.add(Ie),p,w).point:U.point.add(t?Ie.rotate(-l.angle):Ie),_e=h.allowVerticalPlacement&&z.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let Le=0;Le<z.numGlyphs;Le++)c.ak(E,qe,_e);v&&z.associatedIconIndex>=0&&(L[z.associatedIconIndex]={shiftedAnchor:qe,angle:_e})}else k(z.numGlyphs,E)}if(v){B.clear();const F=h.icon.placedSymbolArray;for(let z=0;z<F.length;z++){const G=F.get(z);if(G.hidden)k(G.numGlyphs,B);else{const J=L[z];if(J)for(let U=0;U<G.numGlyphs;U++)c.ak(B,J.shiftedAnchor,J.angle);else k(G.numGlyphs,B)}}h.icon.dynamicLayoutVertexBuffer.updateData(B)}h.text.dynamicLayoutVertexBuffer.updateData(E)}function In(h,t,s){return s.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function Fa(h,t,s,n,l,p,m,g,y,v,w,S){const E=h.context,B=E.gl,L=h.transform,F=g==="map",z=y==="map",G=g!=="viewport"&&s.layout.get("symbol-placement")!=="point",J=F&&!z&&!G,U=!s.layout.get("symbol-sort-key").isConstant();let X=!1;const ee=h.depthModeForSublayer(0,We.ReadOnly),te=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ne=[];for(const he of n){const ce=t.getTile(he),pe=ce.getBucket(s);if(!pe)continue;const Ie=l?pe.text:pe.icon;if(!Ie||!Ie.segments.get().length||!Ie.hasVisibleVertices)continue;const qe=Ie.programConfigurations.get(s.id),_e=l||pe.sdfIcons,Le=l?pe.textSizeData:pe.iconSizeData,Me=z||L.pitch!==0,rt=h.useProgram(In(_e,l,pe),qe),je=c.ah(Le,L.zoom),Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(he);let Ze,Tt,lt,Zt,Lt=[0,0],Et=null;if(l)Tt=ce.glyphAtlasTexture,lt=B.LINEAR,Ze=ce.glyphAtlasTexture.size,pe.iconsInText&&(Lt=ce.imageAtlasTexture.size,Et=ce.imageAtlasTexture,Zt=Me||h.options.rotating||h.options.zooming||Le.kind==="composite"||Le.kind==="camera"?B.LINEAR:B.NEAREST);else{const It=s.layout.get("icon-size").constantOr(0)!==1||pe.iconsNeedLinear;Tt=ce.imageAtlasTexture,lt=_e||h.options.rotating||h.options.zooming||It||Me?B.LINEAR:B.NEAREST,Ze=ce.imageAtlasTexture.size}const Ai=Z(ce,1,h.transform.zoom),ut=fe(he.posMatrix,z,F,h.transform,Ai),ir=Qi(he.posMatrix,z,F,h.transform,Ai),rr=te&&pe.hasTextData(),Or=s.layout.get("icon-text-fit")!=="none"&&rr&&pe.hasIconData();if(G){const It=h.style.map.terrain?(fi,At)=>h.style.map.terrain.getElevation(he,fi,At):null,Bt=s.layout.get("text-rotation-alignment")==="map";ge(pe,he.posMatrix,h,l,ut,ir,z,v,Bt,It)}const rs=h.translatePosMatrix(he.posMatrix,ce,p,m),Ds=G||l&&te||Or?Tn:ut,Kt=h.translatePosMatrix(ir,ce,p,m,!0),Gt=_e&&s.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let si;si=_e?pe.iconsInText?Kr(Le.kind,je,J,z,h,rs,Ds,Kt,Ze,Lt):dn(Le.kind,je,J,z,h,rs,Ds,Kt,l,Ze,!0):pn(Le.kind,je,J,z,h,rs,Ds,Kt,l,Ze);const ss={program:rt,buffers:Ie,uniformValues:si,atlasTexture:Tt,atlasTextureIcon:Et,atlasInterpolation:lt,atlasInterpolationIcon:Zt,isSDF:_e,hasHalo:Gt};if(U&&pe.canOverlap){X=!0;const It=Ie.segments.get();for(const Bt of It)ne.push({segments:new c.S([Bt]),sortKey:Bt.sortKey,state:ss,terrainData:Ne})}else ne.push({segments:Ie.segments,sortKey:0,state:ss,terrainData:Ne})}X&&ne.sort((he,ce)=>he.sortKey-ce.sortKey);for(const he of ne){const ce=he.state;if(E.activeTexture.set(B.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,B.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(E.activeTexture.set(B.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),ce.isSDF){const pe=ce.uniformValues;ce.hasHalo&&(pe.u_is_halo=1,An(ce.buffers,he.segments,s,h,ce.program,ee,w,S,pe,he.terrainData)),pe.u_is_halo=0}An(ce.buffers,he.segments,s,h,ce.program,ee,w,S,ce.uniformValues,he.terrainData)}}function An(h,t,s,n,l,p,m,g,y,v){const w=n.context;l.draw(w,w.gl.TRIANGLES,p,m,g,dt.disabled,y,v,s.id,h.layoutVertexBuffer,h.indexBuffer,t,s.paint,n.transform.zoom,h.programConfigurations.get(s.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function Ys(h,t,s,n,l){if(!s||!n||!n.imageAtlas)return;const p=n.imageAtlas.patternPositions;let m=p[s.to.toString()],g=p[s.from.toString()];if(!m&&g&&(m=g),!g&&m&&(g=m),!m||!g){const y=l.getPaintProperty(t);m=p[y],g=p[y]}m&&g&&h.setConstantPatternPositions(m,g)}function Js(h,t,s,n,l,p,m){const g=h.context.gl,y="fill-pattern",v=s.paint.get(y),w=v&&v.constantOr(1),S=s.getCrossfadeParameters();let E,B,L,F,z;m?(B=w&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",E=g.LINES):(B=w?"fillPattern":"fill",E=g.TRIANGLES);const G=v.constantOr(null);for(const J of n){const U=t.getTile(J);if(w&&!U.patternsLoaded())continue;const X=U.getBucket(s);if(!X)continue;const ee=X.programConfigurations.get(s.id),te=h.useProgram(B,ee),ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(J);w&&(h.context.activeTexture.set(g.TEXTURE0),U.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),ee.updatePaintBuffers(S)),Ys(ee,y,G,U,s);const he=ne?J:null,ce=h.translatePosMatrix(he?he.posMatrix:J.posMatrix,U,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(m){F=X.indexBuffer2,z=X.segments2;const pe=[g.drawingBufferWidth,g.drawingBufferHeight];L=B==="fillOutlinePattern"&&w?Sa(ce,h,S,U,pe):wa(ce,pe)}else F=X.indexBuffer,z=X.segments,L=w?ln(ce,h,S,U):fo(ce);te.draw(h.context,E,l,h.stencilModeForClipping(J),p,dt.disabled,L,ne,s.id,X.layoutVertexBuffer,F,z,s.paint,h.transform.zoom,ee)}}function Qs(h,t,s,n,l,p,m){const g=h.context,y=g.gl,v="fill-extrusion-pattern",w=s.paint.get(v),S=w.constantOr(1),E=s.getCrossfadeParameters(),B=s.paint.get("fill-extrusion-opacity"),L=w.constantOr(null);for(const F of n){const z=t.getTile(F),G=z.getBucket(s);if(!G)continue;const J=h.style.map.terrain&&h.style.map.terrain.getTerrainData(F),U=G.programConfigurations.get(s.id),X=h.useProgram(S?"fillExtrusionPattern":"fillExtrusion",U);S&&(h.context.activeTexture.set(y.TEXTURE0),z.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),U.updatePaintBuffers(E)),Ys(U,v,L,z,s);const ee=h.translatePosMatrix(F.posMatrix,z,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),te=s.paint.get("fill-extrusion-vertical-gradient"),ne=S?zr(ee,h,te,B,F,E,z):on(ee,h,te,B);X.draw(g,g.gl.TRIANGLES,l,p,m,dt.backCCW,ne,J,s.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,s.paint,h.transform.zoom,U,h.style.map.terrain&&G.centroidVertexBuffer)}}function zl(h,t,s,n,l,p,m){const g=h.context,y=g.gl,v=s.fbo;if(!v)return;const w=h.useProgram("hillshade"),S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),w.draw(g,y.TRIANGLES,l,p,m,dt.disabled,((E,B,L,F)=>{const z=L.paint.get("hillshade-shadow-color"),G=L.paint.get("hillshade-highlight-color"),J=L.paint.get("hillshade-accent-color");let U=L.paint.get("hillshade-illumination-direction")*(Math.PI/180);L.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=E.transform.angle);const X=!E.options.moving;return{u_matrix:F?F.posMatrix:E.transform.calculatePosMatrix(B.tileID.toUnwrapped(),X),u_image:0,u_latrange:hn(0,B.tileID),u_light:[L.paint.get("hillshade-exaggeration"),U],u_shadow:z,u_highlight:G,u_accent:J}})(h,s,n,S?t:null),S,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function Mn(h,t,s,n,l,p){const m=h.context,g=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,w=y.stride,S=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(w),t.demTexture){const B=t.demTexture;B.update(S,{premultiply:!1}),B.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else t.demTexture=new mt(m,S,g.RGBA,{premultiply:!1}),t.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let E=t.fbo;if(!E){const B=new mt(m,{width:v,height:v,data:null},g.RGBA);B.bind(g.LINEAR,g.CLAMP_TO_EDGE),E=t.fbo=m.createFramebuffer(v,v,!0,!1),E.colorAttachment.set(B.texture)}m.bindFramebuffer.set(E.framebuffer),m.viewport.set([0,0,v,v]),h.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,n,l,p,dt.disabled,((B,L)=>{const F=L.stride,z=c.Z();return c.aS(z,0,c.N,-c.N,0,0,1),c.$(z,z,[0,-c.N,0]),{u_matrix:z,u_image:1,u_dimension:[F,F],u_zoom:B.overscaledZ,u_unpack:L.getUnpackVector()}})(t.tileID,y),null,s.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Dl(h,t,s,n,l,p){const m=n.paint.get("raster-fade-duration");if(!p&&m>0){const g=c.h.now(),y=(g-h.timeAdded)/m,v=t?(g-t.timeAdded)/m:-1,w=s.getSource(),S=l.coveringZoomLevel({tileSize:w.tileSize,roundZoom:w.roundZoom}),E=!t||Math.abs(t.tileID.overscaledZ-S)>Math.abs(h.tileID.overscaledZ-S),B=E&&h.refreshedUponExpiration?1:c.ad(E?y:1-v,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const Eo=new c.aT(1,0,0,1),Oa=new c.aT(0,1,0,1),En=new c.aT(0,0,1,1),Co=new c.aT(1,0,1,1),Po=new c.aT(0,1,1,1);function ea(h,t,s,n){Na(h,0,t+s/2,h.transform.width,s,n)}function Va(h,t,s,n){Na(h,t-s/2,0,s,h.transform.height,n)}function Na(h,t,s,n,l,p){const m=h.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*h.pixelRatio,s*h.pixelRatio,n*h.pixelRatio,l*h.pixelRatio),m.clear({color:p}),g.disable(g.SCISSOR_TEST)}function ko(h,t,s){const n=h.context,l=n.gl,p=s.posMatrix,m=h.useProgram("debug"),g=We.disabled,y=yt.disabled,v=h.colorModeForRenderPass(),w="$debug",S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(s);n.activeTexture.set(l.TEXTURE0);const E=t.getTileByID(s.key).latestRawTileData,B=Math.floor((E&&E.byteLength||0)/1024),L=t.getTile(s).tileSize,F=512/Math.min(L,512)*(s.overscaledZ/h.transform.zoom)*.5;let z=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(z+=` => ${s.overscaledZ}`),function(G,J){G.initDebugOverlayCanvas();const U=G.debugOverlayCanvas,X=G.context.gl,ee=G.debugOverlayCanvas.getContext("2d");ee.clearRect(0,0,U.width,U.height),ee.shadowColor="white",ee.shadowBlur=2,ee.lineWidth=1.5,ee.strokeStyle="white",ee.textBaseline="top",ee.font="bold 36px Open Sans, sans-serif",ee.fillText(J,5,5),ee.strokeText(J,5,5),G.debugOverlayTexture.update(U),G.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)}(h,`${z} ${B}kB`),m.draw(n,l.TRIANGLES,g,y,_t.alphaBlended,dt.disabled,Ws(p,c.aT.transparent,F),null,w,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(n,l.LINE_STRIP,g,y,v,dt.disabled,Ws(p,c.aT.red),S,w,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function wt(h,t,s){const n=h.context,l=n.gl,p=h.colorModeForRenderPass(),m=new We(l.LEQUAL,We.ReadWrite,h.depthRangeFor3D),g=h.useProgram("terrain"),y=t.getTerrainMesh();n.bindFramebuffer.set(null),n.viewport.set([0,0,h.width,h.height]);for(const v of s){const w=h.renderToTexture.getTexture(v),S=t.getTerrainData(v.tileID);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,w.texture);const E={u_matrix:h.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.transform.zoom)};g.draw(n,l.TRIANGLES,m,yt.disabled,p,dt.backCCW,E,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Qr{constructor(t,s){this.context=new kl(t),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.Z(),renderTime:0},this.setup(),this.numSublayers=ui.maxUnderzooming+ui.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new xa}resize(t,s,n){if(this.width=Math.floor(t*n),this.height=Math.floor(s*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const t=this.context,s=new c.a_;s.emplaceBack(0,0),s.emplaceBack(c.N,0),s.emplaceBack(0,c.N),s.emplaceBack(c.N,c.N),this.tileExtentBuffer=t.createVertexBuffer(s,va.members),this.tileExtentSegments=c.S.simpleSegment(0,0,4,2);const n=new c.a_;n.emplaceBack(0,0),n.emplaceBack(c.N,0),n.emplaceBack(0,c.N),n.emplaceBack(c.N,c.N),this.debugBuffer=t.createVertexBuffer(n,va.members),this.debugSegments=c.S.simpleSegment(0,0,4,5);const l=new c.V;l.emplaceBack(0,0,0,0),l.emplaceBack(c.N,0,c.N,0),l.emplaceBack(0,c.N,0,c.N),l.emplaceBack(c.N,c.N,c.N,c.N),this.rasterBoundsBuffer=t.createVertexBuffer(l,ji.members),this.rasterBoundsSegments=c.S.simpleSegment(0,0,4,2);const p=new c.a_;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,va.members),this.viewportSegments=c.S.simpleSegment(0,0,4,2);const m=new c.a$;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const g=new c.b0;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new yt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,s=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=c.Z();c.aS(n,0,this.width,this.height,0,0,1),c.a0(n,n,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,s.TRIANGLES,We.disabled,this.stencilClearMode,_t.disabled,dt.disabled,mo(n),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,s){if(this.currentStencilSource===t.source||!t.isTileClipped()||!s||!s.length)return;this.currentStencilSource=t.source;const n=this.context,l=n.gl;this.nextStencilID+s.length>256&&this.clearStencil(),n.setColorMode(_t.disabled),n.setDepthMode(We.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of s){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(n,l.TRIANGLES,We.disabled,new yt({func:l.ALWAYS,mask:0},g,255,l.KEEP,l.KEEP,l.REPLACE),_t.disabled,dt.disabled,mo(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,s=this.context.gl;return new yt({func:s.NOTEQUAL,mask:255},t,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(t){const s=this.context.gl;return new yt({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(t){const s=this.context.gl,n=t.sort((m,g)=>g.overscaledZ-m.overscaledZ),l=n[n.length-1].overscaledZ,p=n[0].overscaledZ-l+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let g=0;g<p;g++)m[g+l]=new yt({func:s.GEQUAL,mask:255},g+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=p,[m,n]}return[{[l]:yt.disabled},n]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new _t([t.CONSTANT_COLOR,t.ONE],new c.aT(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?_t.unblended:_t.alphaBlended}depthModeForSublayer(t,s,n){if(!this.opaquePassEnabledForLayer())return We.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new We(n||this.context.gl.LEQUAL,s,[l,l])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,s){this.style=t,this.options=s,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(c.h.now()),this.imageManager.beginFrame();const n=this.style._order,l=this.style.sourceCaches,p={},m={},g={};for(const y in l){const v=l[y];v.used&&v.prepare(this.context),p[y]=v.getVisibleCoordinates(),m[y]=p[y].slice().reverse(),g[y]=v.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<n.length;y++)if(this.style._layers[n[y]].is3D()){this.opaquePassCutoff=y;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!c.b1(this.terrainFacilitator.matrix,this.transform.projMatrix)||y.length)&&(c.b2(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,w){const S=v.context,E=S.gl,B=_t.unblended,L=new We(E.LEQUAL,We.ReadWrite,[0,1]),F=w.getTerrainMesh(),z=w.sourceCache.getRenderableTiles(),G=v.useProgram("terrainDepth");S.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),S.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),S.clear({color:c.aT.transparent,depth:1});for(const J of z){const U=w.getTerrainData(J.tileID),X={u_matrix:v.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(v.transform.zoom)};G.draw(S,E.TRIANGLES,L,yt.disabled,B,dt.backCCW,X,U,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}S.bindFramebuffer.set(null),S.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,w){const S=v.context,E=S.gl,B=_t.unblended,L=new We(E.LEQUAL,We.ReadWrite,[0,1]),F=w.getTerrainMesh(),z=w.getCoordsTexture(),G=w.sourceCache.getRenderableTiles(),J=v.useProgram("terrainCoords");S.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),S.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),S.clear({color:c.aT.transparent,depth:1}),w.coordsIndex=[];for(const U of G){const X=w.getTerrainData(U.tileID);S.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,z.texture);const ee={u_matrix:v.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(v.transform.zoom)};J.draw(S,E.TRIANGLES,L,yt.disabled,B,dt.backCCW,ee,X,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),w.coordsIndex.push(U.tileID.key)}S.bindFramebuffer.set(null),S.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const y of n){const v=this.style._layers[y];if(!v.hasOffscreenPass()||v.isHidden(this.transform.zoom))continue;const w=m[v.source];(v.type==="custom"||w.length)&&this.renderLayer(this,l[v.source],v,w)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?c.aT.black:c.aT.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[n[this.currentLayer]],v=l[y.source],w=p[y.source];this._renderTileClippingMasks(y,w),this.renderLayer(this,v,y,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const y=this.style._layers[n[this.currentLayer]],v=l[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const w=(y.type==="symbol"?g:m)[y.source];this._renderTileClippingMasks(y,p[y.source]),this.renderLayer(this,v,y,w)}if(this.options.showTileBoundaries){const y=function(v,w){let S=null;const E=Object.values(v._layers).flatMap(z=>z.source&&!z.isHidden(w)?[v.sourceCaches[z.source]]:[]),B=E.filter(z=>z.getSource().type==="vector"),L=E.filter(z=>z.getSource().type!=="vector"),F=z=>{(!S||S.getSource().maxzoom<z.getSource().maxzoom)&&(S=z)};return B.forEach(z=>F(z)),S||L.forEach(z=>F(z)),S}(this.style,this.transform.zoom);y&&function(v,w,S){for(let E=0;E<S.length;E++)ko(v,w,S[E])}(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){const v=y.transform.padding;ea(y,y.transform.height-(v.top||0),3,Eo),ea(y,v.bottom||0,3,Oa),Va(y,v.left||0,3,En),Va(y,y.transform.width-(v.right||0),3,Co);const w=y.transform.centerPoint;(function(S,E,B,L){Na(S,E-1,B-10,2,20,L),Na(S,E-10,B-1,20,2,L)})(y,w.x,y.transform.height-w.y,Po)}(this),this.context.setDefault()}renderLayer(t,s,n,l){if(!n.isHidden(this.transform.zoom)&&(n.type==="background"||n.type==="custom"||(l||[]).length))switch(this.id=n.id,n.type){case"symbol":(function(p,m,g,y,v){if(p.renderPass!=="translucent")return;const w=yt.disabled,S=p.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(E,B,L,F,z,G,J){const U=B.transform,X=z==="map",ee=G==="map";for(const te of E){const ne=F.getTile(te),he=ne.getBucket(L);if(!he||!he.text||!he.text.segments.get().length)continue;const ce=c.ah(he.textSizeData,U.zoom),pe=Z(ne,1,B.transform.zoom),Ie=fe(te.posMatrix,ee,X,B.transform,pe),qe=L.layout.get("icon-text-fit")!=="none"&&he.hasIconData();if(ce){const _e=Math.pow(2,U.zoom-ne.tileID.overscaledZ);Ra(he,X,ee,J,U,Ie,te.posMatrix,_e,ce,qe,B.style.map.terrain?(Le,Me)=>B.style.map.terrain.getElevation(te,Le,Me):null)}}}(y,p,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),v),g.paint.get("icon-opacity").constantOr(1)!==0&&Fa(p,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),w,S),g.paint.get("text-opacity").constantOr(1)!==0&&Fa(p,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),w,S),m.map.showCollisionBoxes&&(Mo(p,m,g,y,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),!0),Mo(p,m,g,y,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),!1))})(t,s,n,l,this.style.placement.variableOffsets);break;case"circle":(function(p,m,g,y){if(p.renderPass!=="translucent")return;const v=g.paint.get("circle-opacity"),w=g.paint.get("circle-stroke-width"),S=g.paint.get("circle-stroke-opacity"),E=!g.layout.get("circle-sort-key").isConstant();if(v.constantOr(1)===0&&(w.constantOr(1)===0||S.constantOr(1)===0))return;const B=p.context,L=B.gl,F=p.depthModeForSublayer(0,We.ReadOnly),z=yt.disabled,G=p.colorModeForRenderPass(),J=[];for(let U=0;U<y.length;U++){const X=y[U],ee=m.getTile(X),te=ee.getBucket(g);if(!te)continue;const ne=te.programConfigurations.get(g.id),he=p.useProgram("circle",ne),ce=te.layoutVertexBuffer,pe=te.indexBuffer,Ie=p.style.map.terrain&&p.style.map.terrain.getTerrainData(X),qe={programConfiguration:ne,program:he,layoutVertexBuffer:ce,indexBuffer:pe,uniformValues:Dr(p,X,ee,g),terrainData:Ie};if(E){const _e=te.segments.get();for(const Le of _e)J.push({segments:new c.S([Le]),sortKey:Le.sortKey,state:qe})}else J.push({segments:te.segments,sortKey:0,state:qe})}E&&J.sort((U,X)=>U.sortKey-X.sortKey);for(const U of J){const{programConfiguration:X,program:ee,layoutVertexBuffer:te,indexBuffer:ne,uniformValues:he,terrainData:ce}=U.state;ee.draw(B,L.TRIANGLES,F,z,G,dt.disabled,he,ce,g.id,te,ne,U.segments,g.paint,p.transform.zoom,X)}})(t,s,n,l);break;case"heatmap":(function(p,m,g,y){if(g.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){const v=p.context,w=v.gl,S=yt.disabled,E=new _t([w.ONE,w.ONE],c.aT.transparent,[!0,!0,!0,!0]);(function(B,L,F){const z=B.gl;B.activeTexture.set(z.TEXTURE1),B.viewport.set([0,0,L.width/4,L.height/4]);let G=F.heatmapFbo;if(G)z.bindTexture(z.TEXTURE_2D,G.colorAttachment.get()),B.bindFramebuffer.set(G.framebuffer);else{const J=z.createTexture();z.bindTexture(z.TEXTURE_2D,J),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_S,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_T,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.LINEAR),G=F.heatmapFbo=B.createFramebuffer(L.width/4,L.height/4,!1,!1),function(U,X,ee,te){var ne,he;const ce=U.gl,pe=(ne=U.HALF_FLOAT)!==null&&ne!==void 0?ne:ce.UNSIGNED_BYTE,Ie=(he=U.RGBA16F)!==null&&he!==void 0?he:ce.RGBA;ce.texImage2D(ce.TEXTURE_2D,0,Ie,X.width/4,X.height/4,0,ce.RGBA,pe,null),te.colorAttachment.set(ee)}(B,L,J,G)}})(v,p,g),v.clear({color:c.aT.transparent});for(let B=0;B<y.length;B++){const L=y[B];if(m.hasRenderableParent(L))continue;const F=m.getTile(L),z=F.getBucket(g);if(!z)continue;const G=z.programConfigurations.get(g.id),J=p.useProgram("heatmap",G),{zoom:U}=p.transform;J.draw(v,w.TRIANGLES,We.disabled,S,E,dt.disabled,Sl(L.posMatrix,F,U,g.paint.get("heatmap-intensity")),null,g.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,g.paint,p.transform.zoom,G)}v.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(v,w){const S=v.context,E=S.gl,B=w.heatmapFbo;if(!B)return;S.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,B.colorAttachment.get()),S.activeTexture.set(E.TEXTURE1);let L=w.colorRampTexture;L||(L=w.colorRampTexture=new mt(S,w.colorRamp,E.RGBA)),L.bind(E.LINEAR,E.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(S,E.TRIANGLES,We.disabled,yt.disabled,v.colorModeForRenderPass(),dt.disabled,((F,z,G,J)=>{const U=c.Z();c.aS(U,0,F.width,F.height,0,0,1);const X=F.context.gl;return{u_matrix:U,u_world:[X.drawingBufferWidth,X.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:z.paint.get("heatmap-opacity")}})(v,w),null,w.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,w.paint,v.transform.zoom)}(p,g))})(t,s,n,l);break;case"line":(function(p,m,g,y){if(p.renderPass!=="translucent")return;const v=g.paint.get("line-opacity"),w=g.paint.get("line-width");if(v.constantOr(1)===0||w.constantOr(1)===0)return;const S=p.depthModeForSublayer(0,We.ReadOnly),E=p.colorModeForRenderPass(),B=g.paint.get("line-dasharray"),L=g.paint.get("line-pattern"),F=L.constantOr(1),z=g.paint.get("line-gradient"),G=g.getCrossfadeParameters(),J=F?"linePattern":B?"lineSDF":z?"lineGradient":"line",U=p.context,X=U.gl;let ee=!0;for(const te of y){const ne=m.getTile(te);if(F&&!ne.patternsLoaded())continue;const he=ne.getBucket(g);if(!he)continue;const ce=he.programConfigurations.get(g.id),pe=p.context.program.get(),Ie=p.useProgram(J,ce),qe=ee||Ie.program!==pe,_e=p.style.map.terrain&&p.style.map.terrain.getTerrainData(te),Le=L.constantOr(null);if(Le&&ne.imageAtlas){const je=ne.imageAtlas,Ne=je.patternPositions[Le.to.toString()],Ze=je.patternPositions[Le.from.toString()];Ne&&Ze&&ce.setConstantPatternPositions(Ne,Ze)}const Me=_e?te:null,rt=F?Tl(p,ne,g,G,Me):B?_o(p,ne,g,B,G,Me):z?go(p,ne,g,he.lineClipsArray.length,Me):un(p,ne,g,Me);if(F)U.activeTexture.set(X.TEXTURE0),ne.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),ce.updatePaintBuffers(G);else if(B&&(qe||p.lineAtlas.dirty))U.activeTexture.set(X.TEXTURE0),p.lineAtlas.bind(U);else if(z){const je=he.gradients[g.id];let Ne=je.texture;if(g.gradientVersion!==je.version){let Ze=256;if(g.stepInterpolant){const Tt=m.getSource().maxzoom,lt=te.canonical.z===Tt?Math.ceil(1<<p.transform.maxZoom-te.canonical.z):1;Ze=c.ad(c.aY(he.maxLineLength/c.N*1024*lt),256,U.maxTextureSize)}je.gradient=c.aZ({expression:g.gradientExpression(),evaluationKey:"lineProgress",resolution:Ze,image:je.gradient||void 0,clips:he.lineClipsArray}),je.texture?je.texture.update(je.gradient):je.texture=new mt(U,je.gradient,X.RGBA),je.version=g.gradientVersion,Ne=je.texture}U.activeTexture.set(X.TEXTURE0),Ne.bind(g.stepInterpolant?X.NEAREST:X.LINEAR,X.CLAMP_TO_EDGE)}Ie.draw(U,X.TRIANGLES,S,p.stencilModeForClipping(te),E,dt.disabled,rt,_e,g.id,he.layoutVertexBuffer,he.indexBuffer,he.segments,g.paint,p.transform.zoom,ce,he.layoutVertexBuffer2),ee=!1}})(t,s,n,l);break;case"fill":(function(p,m,g,y){const v=g.paint.get("fill-color"),w=g.paint.get("fill-opacity");if(w.constantOr(1)===0)return;const S=p.colorModeForRenderPass(),E=g.paint.get("fill-pattern"),B=p.opaquePassEnabledForLayer()&&!E.constantOr(1)&&v.constantOr(c.aT.transparent).a===1&&w.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===B){const L=p.depthModeForSublayer(1,p.renderPass==="opaque"?We.ReadWrite:We.ReadOnly);Js(p,m,g,y,L,S,!1)}if(p.renderPass==="translucent"&&g.paint.get("fill-antialias")){const L=p.depthModeForSublayer(g.getPaintProperty("fill-outline-color")?2:0,We.ReadOnly);Js(p,m,g,y,L,S,!0)}})(t,s,n,l);break;case"fill-extrusion":(function(p,m,g,y){const v=g.paint.get("fill-extrusion-opacity");if(v!==0&&p.renderPass==="translucent"){const w=new We(p.context.gl.LEQUAL,We.ReadWrite,p.depthRangeFor3D);if(v!==1||g.paint.get("fill-extrusion-pattern").constantOr(1))Qs(p,m,g,y,w,yt.disabled,_t.disabled),Qs(p,m,g,y,w,p.stencilModeFor3D(),p.colorModeForRenderPass());else{const S=p.colorModeForRenderPass();Qs(p,m,g,y,w,yt.disabled,S)}}})(t,s,n,l);break;case"hillshade":(function(p,m,g,y){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;const v=p.context,w=p.depthModeForSublayer(0,We.ReadOnly),S=p.colorModeForRenderPass(),[E,B]=p.renderPass==="translucent"?p.stencilConfigForOverlap(y):[{},y];for(const L of B){const F=m.getTile(L);F.needsHillshadePrepare!==void 0&&F.needsHillshadePrepare&&p.renderPass==="offscreen"?Mn(p,F,g,w,yt.disabled,S):p.renderPass==="translucent"&&zl(p,L,F,g,w,E[L.overscaledZ],S)}v.viewport.set([0,0,p.width,p.height])})(t,s,n,l);break;case"raster":(function(p,m,g,y){if(p.renderPass!=="translucent"||g.paint.get("raster-opacity")===0||!y.length)return;const v=p.context,w=v.gl,S=m.getSource(),E=p.useProgram("raster"),B=p.colorModeForRenderPass(),[L,F]=S instanceof zi?[{},y]:p.stencilConfigForOverlap(y),z=F[F.length-1].overscaledZ,G=!p.options.moving;for(const J of F){const U=p.depthModeForSublayer(J.overscaledZ-z,g.paint.get("raster-opacity")===1?We.ReadWrite:We.ReadOnly,w.LESS),X=m.getTile(J);X.registerFadeDuration(g.paint.get("raster-fade-duration"));const ee=m.findLoadedParent(J,0),te=Dl(X,ee,m,g,p.transform,p.style.map.terrain);let ne,he;const ce=g.paint.get("raster-resampling")==="nearest"?w.NEAREST:w.LINEAR;v.activeTexture.set(w.TEXTURE0),X.texture.bind(ce,w.CLAMP_TO_EDGE,w.LINEAR_MIPMAP_NEAREST),v.activeTexture.set(w.TEXTURE1),ee?(ee.texture.bind(ce,w.CLAMP_TO_EDGE,w.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,ee.tileID.overscaledZ-X.tileID.overscaledZ),he=[X.tileID.canonical.x*ne%1,X.tileID.canonical.y*ne%1]):X.texture.bind(ce,w.CLAMP_TO_EDGE,w.LINEAR_MIPMAP_NEAREST);const pe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(J),Ie=pe?J:null,qe=Ie?Ie.posMatrix:p.transform.calculatePosMatrix(J.toUnwrapped(),G),_e=xo(qe,he||[0,0],ne||1,te,g);S instanceof zi?E.draw(v,w.TRIANGLES,U,yt.disabled,B,dt.disabled,_e,pe,g.id,S.boundsBuffer,p.quadTriangleIndexBuffer,S.boundsSegments):E.draw(v,w.TRIANGLES,U,L[J.overscaledZ],B,dt.disabled,_e,pe,g.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}})(t,s,n,l);break;case"background":(function(p,m,g,y){const v=g.paint.get("background-color"),w=g.paint.get("background-opacity");if(w===0)return;const S=p.context,E=S.gl,B=p.transform,L=B.tileSize,F=g.paint.get("background-pattern");if(p.isPatternMissing(F))return;const z=!F&&v.a===1&&w===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==z)return;const G=yt.disabled,J=p.depthModeForSublayer(0,z==="opaque"?We.ReadWrite:We.ReadOnly),U=p.colorModeForRenderPass(),X=p.useProgram(F?"backgroundPattern":"background"),ee=y||B.coveringTiles({tileSize:L,terrain:p.style.map.terrain});F&&(S.activeTexture.set(E.TEXTURE0),p.imageManager.bind(p.context));const te=g.getCrossfadeParameters();for(const ne of ee){const he=y?ne.posMatrix:p.transform.calculatePosMatrix(ne.toUnwrapped()),ce=F?Fi(he,w,p,F,{tileID:ne,tileSize:L},te):Ia(he,w,v),pe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(ne);X.draw(S,E.TRIANGLES,J,G,U,dt.disabled,ce,pe,g.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}})(t,0,n,l);break;case"custom":(function(p,m,g){const y=p.context,v=g.implementation;if(p.renderPass==="offscreen"){const w=v.prerender;w&&(p.setCustomLayerDefaults(),y.setColorMode(p.colorModeForRenderPass()),w.call(v,y.gl,p.transform.customLayerMatrix()),y.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),y.setColorMode(p.colorModeForRenderPass()),y.setStencilMode(yt.disabled);const w=v.renderingMode==="3d"?new We(p.context.gl.LEQUAL,We.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,We.ReadOnly);y.setDepthMode(w),v.render(y.gl,p.transform.customLayerMatrix()),y.setDirty(),p.setBaseState(),y.bindFramebuffer.set(null)}})(t,0,n)}}translatePosMatrix(t,s,n,l,p){if(!n[0]&&!n[1])return t;const m=p?l==="map"?this.transform.angle:0:l==="viewport"?-this.transform.angle:0;if(m){const v=Math.sin(m),w=Math.cos(m);n=[n[0]*w-n[1]*v,n[0]*v+n[1]*w]}const g=[p?n[0]:Z(s,n[0],this.transform.zoom),p?n[1]:Z(s,n[1],this.transform.zoom),0],y=new Float32Array(16);return c.$(y,t,g),y}saveTileTexture(t){const s=this._tileTextures[t.size[0]];s?s.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const s=this._tileTextures[t];return s&&s.length>0?s.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const s=this.imageManager.getPattern(t.from.toString()),n=this.imageManager.getPattern(t.to.toString());return!s||!n}useProgram(t,s){this.cache=this.cache||{};const n=t+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[n]||(this.cache[n]=new ba(this.context,gt[t],s,Aa[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[n]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new mt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:s}=this.context.gl;return this.width!==t||this.height!==s}}class pi{constructor(t,s){this.points=t,this.planes=s}static fromInvProjectionMatrix(t,s,n){const l=Math.pow(2,n),p=[[-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(g=>{const y=1/(g=c.ag([],g,t))[3]/s*l;return c.b3(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const y=function(E,B){var L=B[0],F=B[1],z=B[2],G=L*L+F*F+z*z;return G>0&&(G=1/Math.sqrt(G)),E[0]=B[0]*G,E[1]=B[1]*G,E[2]=B[2]*G,E}([],function(E,B,L){var F=B[0],z=B[1],G=B[2],J=L[0],U=L[1],X=L[2];return E[0]=z*X-G*U,E[1]=G*J-F*X,E[2]=F*U-z*J,E}([],Ki([],p[g[0]],p[g[1]]),Ki([],p[g[2]],p[g[1]]))),v=-((w=y)[0]*(S=p[g[1]])[0]+w[1]*S[1]+w[2]*S[2]);var w,S;return y.concat(v)});return new pi(p,m)}}class Ms{constructor(t,s){this.min=t,this.max=s,this.center=function(n,l,p){return n[0]=.5*l[0],n[1]=.5*l[1],n[2]=.5*l[2],n}([],function(n,l,p){return n[0]=l[0]+p[0],n[1]=l[1]+p[1],n[2]=l[2]+p[2],n}([],this.min,this.max))}quadrant(t){const s=[t%2==0,t<2],n=$s(this.min),l=$s(this.max);for(let p=0;p<s.length;p++)n[p]=s[p]?this.min[p]:this.center[p],l[p]=s[p]?this.center[p]:this.max[p];return l[2]=this.max[2],new Ms(n,l)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const s=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let n=!0;for(let l=0;l<t.planes.length;l++){const p=t.planes[l];let m=0;for(let g=0;g<s.length;g++)c.b4(p,s[g])>=0&&m++;if(m===0)return 0;m!==s.length&&(n=!1)}if(n)return 2;for(let l=0;l<3;l++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;g<t.points.length;g++){const y=t.points[g][l]-this.min[l];p=Math.min(p,y),m=Math.max(m,y)}if(m<0||p>this.max[l]-this.min[l])return 0}return 1}}class ta{constructor(t=0,s=0,n=0,l=0){if(isNaN(t)||t<0||isNaN(s)||s<0||isNaN(n)||n<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=s,this.left=n,this.right=l}interpolate(t,s,n){return s.top!=null&&t.top!=null&&(this.top=c.B.number(t.top,s.top,n)),s.bottom!=null&&t.bottom!=null&&(this.bottom=c.B.number(t.bottom,s.bottom,n)),s.left!=null&&t.left!=null&&(this.left=c.B.number(t.left,s.left,n)),s.right!=null&&t.right!=null&&(this.right=c.B.number(t.right,s.right,n)),this}getCenter(t,s){const n=c.ad((this.left+t-this.right)/2,0,t),l=c.ad((this.top+s-this.bottom)/2,0,s);return new c.P(n,l)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ua{constructor(t,s,n,l,p){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=s||22,this._minPitch=n??0,this._maxPitch=l??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ta,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new Ua(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}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.angle/Math.PI*180}set bearing(t){const s=-c.b5(t,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=function(){var n=new c.A(4);return c.A!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n}(),function(n,l,p){var m=l[0],g=l[1],y=l[2],v=l[3],w=Math.sin(p),S=Math.cos(p);n[0]=m*S+y*w,n[1]=g*S+v*w,n[2]=m*-w+y*S,n[3]=g*-w+v*S}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const s=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const s=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.tileZoom=Math.max(0,Math.floor(s)),this.scale=this.zoomScale(s),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,s,n){this._unmodified=!1,this._edgeInsets.interpolate(t,s,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const s=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(t){const s=[new c.b6(0,t)];if(this._renderWorldCopies){const n=this.pointCoordinate(new c.P(0,0)),l=this.pointCoordinate(new c.P(this.width,0)),p=this.pointCoordinate(new c.P(this.width,this.height)),m=this.pointCoordinate(new c.P(0,this.height)),g=Math.floor(Math.min(n.x,l.x,p.x,m.x)),y=Math.floor(Math.max(n.x,l.x,p.x,m.x)),v=1;for(let w=g-v;w<=y+v;w++)w!==0&&s.push(new c.b6(w,t))}return s}coveringTiles(t){var s,n;let l=this.coveringZoomLevel(t);const p=l;if(t.minzoom!==void 0&&l<t.minzoom)return[];t.maxzoom!==void 0&&l>t.maxzoom&&(l=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=c.U.fromLngLat(this.center),y=Math.pow(2,l),v=[y*m.x,y*m.y,0],w=[y*g.x,y*g.y,0],S=pi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,l);let E=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(E=l);const B=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,L=U=>({aabb:new Ms([U*y,0,0],[(U+1)*y,y,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),F=[],z=[],G=l,J=t.reparseOverscaled?p:l;if(this._renderWorldCopies)for(let U=1;U<=3;U++)F.push(L(-U)),F.push(L(U));for(F.push(L(0));F.length>0;){const U=F.pop(),X=U.x,ee=U.y;let te=U.fullyVisible;if(!te){const Ie=U.aabb.intersects(S);if(Ie===0)continue;te=Ie===2}const ne=t.terrain?v:w,he=U.aabb.distanceX(ne),ce=U.aabb.distanceY(ne),pe=Math.max(Math.abs(he),Math.abs(ce));if(U.zoom===G||pe>B+(1<<G-U.zoom)-2&&U.zoom>=E){const Ie=G-U.zoom,qe=v[0]-.5-(X<<Ie),_e=v[1]-.5-(ee<<Ie);z.push({tileID:new c.O(U.zoom===G?J:U.zoom,U.wrap,U.zoom,X,ee),distanceSq:js([w[0]-.5-X,w[1]-.5-ee]),tileDistanceToCamera:Math.sqrt(qe*qe+_e*_e)})}else for(let Ie=0;Ie<4;Ie++){const qe=(X<<1)+Ie%2,_e=(ee<<1)+(Ie>>1),Le=U.zoom+1;let Me=U.aabb.quadrant(Ie);if(t.terrain){const rt=new c.O(Le,U.wrap,Le,qe,_e),je=t.terrain.getMinMaxElevation(rt),Ne=(s=je.minElevation)!==null&&s!==void 0?s:this.elevation,Ze=(n=je.maxElevation)!==null&&n!==void 0?n:this.elevation;Me=new Ms([Me.min[0],Me.min[1],Ne],[Me.max[0],Me.max[1],Ze])}F.push({aabb:Me,zoom:Le,x:qe,y:_e,wrap:U.wrap,fullyVisible:te})}}return z.sort((U,X)=>U.distanceSq-X.distanceSq).map(U=>U.tileID)}resize(t,s){this.width=t,this.height=s,this.pixelsToGLUnits=[2/t,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const s=c.ad(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.P(c.G(t.lng)*this.worldSize,c.H(s)*this.worldSize)}unproject(t){return new c.U(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const s=this.pointLocation(this.centerPoint,t),n=t.getElevationForLngLatZoom(s,this.tileZoom);if(!(this.elevation-n))return;const l=this.getCameraPosition(),p=c.U.fromLngLat(l.lngLat,l.altitude),m=c.U.fromLngLat(s,n),g=p.x-m.x,y=p.y-m.y,v=p.z-m.z,w=Math.sqrt(g*g+y*y+v*v),S=this.scaleZoom(this.cameraToCenterDistance/w/this.tileSize);this._elevation=n,this._center=s,this.zoom=S}setLocationAtPoint(t,s){const n=this.pointCoordinate(s),l=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),m=new c.U(p.x-(n.x-l.x),p.y-(n.y-l.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,s){return s?this.coordinatePoint(this.locationCoordinate(t),s.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,s){return this.coordinateLocation(this.pointCoordinate(t,s))}locationCoordinate(t){return c.U.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,s){if(s){const E=s.pointCoordinate(t);if(E!=null)return E}const n=[t.x,t.y,0,1],l=[t.x,t.y,1,1];c.ag(n,n,this.pixelMatrixInverse),c.ag(l,l,this.pixelMatrixInverse);const p=n[3],m=l[3],g=n[1]/p,y=l[1]/m,v=n[2]/p,w=l[2]/m,S=v===w?0:(0-v)/(w-v);return new c.U(c.B.number(n[0]/p,l[0]/m,S)/this.worldSize,c.B.number(g,y,S)/this.worldSize)}coordinatePoint(t,s=0,n=this.pixelMatrix){const l=[t.x*this.worldSize,t.y*this.worldSize,s,1];return c.ag(l,l,n),new c.P(l[0]/l[3],l[1]/l[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ct().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ct([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,s=!1){const n=t.key,l=s?this._alignedPosMatrixCache:this._posMatrixCache;if(l[n])return l[n];const p=t.canonical,m=this.worldSize/this.zoomScale(p.z),g=p.x+Math.pow(2,p.z)*t.wrap,y=c.ao(new Float64Array(16));return c.$(y,y,[g*m,p.y*m,0]),c.a0(y,y,[m/c.N,m/c.N,1]),c.a1(y,s?this.alignedProjMatrix:this.projMatrix,y),l[n]=new Float32Array(y),l[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,s,n,l,p=-90,m=90,g=-180,y=180;const v=this.size,w=this._unmodified;if(this.latRange){const B=this.latRange;p=c.H(B[1])*this.worldSize,m=c.H(B[0])*this.worldSize,t=m-p<v.y?v.y/(m-p):0}if(this.lngRange){const B=this.lngRange;g=c.b5(c.G(B[0])*this.worldSize,0,this.worldSize),y=c.b5(c.G(B[1])*this.worldSize,0,this.worldSize),y<g&&(y+=this.worldSize),s=y-g<v.x?v.x/(y-g):0}const S=this.point,E=Math.max(s||0,t||0);if(E)return this.center=this.unproject(new c.P(s?(y+g)/2:S.x,t?(m+p)/2:S.y)),this.zoom+=this.scaleZoom(E),this._unmodified=w,void(this._constraining=!1);if(this.latRange){const B=S.y,L=v.y/2;B-L<p&&(l=p+L),B+L>m&&(l=m-L)}if(this.lngRange){const B=(g+y)/2,L=c.b5(S.x,B-this.worldSize/2,B+this.worldSize/2),F=v.x/2;L-F<g&&(n=g+F),L+F>y&&(n=y-F)}n===void 0&&l===void 0||(this.center=this.unproject(new c.P(n!==void 0?n:S.x,l!==void 0?l:S.y)).wrap()),this._unmodified=w,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,s=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b7(1,this.center.lat)*this.worldSize;let l=c.ao(new Float64Array(16));c.a0(l,l,[this.width/2,-this.height/2,1]),c.$(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=c.ao(new Float64Array(16)),c.a0(l,l,[1,-1,1]),c.$(l,l,[-1,-1,0]),c.a0(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l;const p=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this._minEleveationForCurrentTile),g=p-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:p,v=Math.PI/2+this._pitch,w=this._fov*(.5+t.y/this.height),S=Math.sin(w)*y/Math.sin(c.ad(Math.PI-v-w,.01,Math.PI-.01)),E=this.getHorizon(),B=2*Math.atan(E/this.cameraToCenterDistance)*(.5+t.y/(2*E)),L=Math.sin(B)*y/Math.sin(c.ad(Math.PI-v-B,.01,Math.PI-.01)),F=Math.min(S,L),z=1.01*(Math.cos(Math.PI/2-this._pitch)*F+y),G=this.height/50;l=new Float64Array(16),c.b8(l,this._fov,this.width/this.height,G,z),l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,c.a0(l,l,[1,-1,1]),c.$(l,l,[0,0,-this.cameraToCenterDistance]),c.b9(l,l,this._pitch),c.ae(l,l,this.angle),c.$(l,l,[-s,-n,0]),this.mercatorMatrix=c.a0([],l,[this.worldSize,this.worldSize,this.worldSize]),c.a0(l,l,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.a1(new Float64Array(16),this.labelPlaneMatrix,l),c.$(l,l,[0,0,-this.elevation]),this.projMatrix=l,this.invProjMatrix=c.as([],l),this.pixelMatrix3D=c.a1(new Float64Array(16),this.labelPlaneMatrix,l);const J=this.width%2/2,U=this.height%2/2,X=Math.cos(this.angle),ee=Math.sin(this.angle),te=s-Math.round(s)+X*J+ee*U,ne=n-Math.round(n)+X*U+ee*J,he=new Float64Array(l);if(c.$(he,he,[te>.5?te-1:te,ne>.5?ne-1:ne,0]),this.alignedProjMatrix=he,l=c.as(new Float64Array(16),this.pixelMatrix),!l)throw new Error("failed to invert matrix");this.pixelMatrixInverse=l,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),s=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const s=this.getCameraPoint();if(t.length===1)return[t[0],s];{let n=s.x,l=s.y,p=s.x,m=s.y;for(const g of t)n=Math.min(n,g.x),l=Math.min(l,g.y),p=Math.max(p,g.x),m=Math.max(m,g.y);return[new c.P(n,l),new c.P(p,l),new c.P(p,m),new c.P(n,m),new c.P(n,l)]}}}function es(h,t){let s,n=!1,l=null,p=null;const m=()=>{l=null,n&&(h.apply(p,s),l=setTimeout(m,t),n=!1)};return(...g)=>(n=!0,p=this,s=g,l||m(),l)}class ia{constructor(t){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let n;return s.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(n=l)}),(n&&n[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:n,pitch:+(s[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const s=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,s)}catch{}},this._updateHash=es(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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()),delete this._map,this}getHashString(t){const s=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,l=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),m=Math.round(s.lng*p)/p,g=Math.round(s.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let w="";if(w+=t?`/${m}/${g}/${n}`:`${n}/${g}/${m}`,(y||v)&&(w+="/"+Math.round(10*y)/10),v&&(w+=`/${Math.round(v)}`),this._hashName){const S=this._hashName;let E=!1;const B=window.location.hash.slice(1).split("&").map(L=>{const F=L.split("=")[0];return F===S?(E=!0,`${F}=${w}`):L}).filter(L=>L);return E||B.push(`${S}=${w}`),`#${B.join("&")}`}return`#${w}`}}const Es={linearity:.3,easing:c.ba(0,0,.3,1)},zo=c.e({deceleration:2500,maxSpeed:1400},Es),Do=c.e({deceleration:20,maxSpeed:1400},Es),Lo=c.e({deceleration:1e3,maxSpeed:360},Es),Bo=c.e({deceleration:1e3,maxSpeed:90},Es);class Ro{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.h.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,s=c.h.now();for(;t.length>0&&s-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)s.zoom+=p.zoomDelta||0,s.bearing+=p.bearingDelta||0,s.pitch+=p.pitchDelta||0,p.panDelta&&s.pan._add(p.panDelta),p.around&&(s.around=p.around),p.pinchAround&&(s.pinchAround=p.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(s.pan.mag()){const p=ra(s.pan.mag(),n,c.e({},zo,t||{}));l.offset=s.pan.mult(p.amount/s.pan.mag()),l.center=this._map.transform.center,tr(l,p)}if(s.zoom){const p=ra(s.zoom,n,Do);l.zoom=this._map.transform.zoom+p.amount,tr(l,p)}if(s.bearing){const p=ra(s.bearing,n,Lo);l.bearing=this._map.transform.bearing+c.ad(p.amount,-179,179),tr(l,p)}if(s.pitch){const p=ra(s.pitch,n,Bo);l.pitch=this._map.transform.pitch+p.amount,tr(l,p)}if(l.zoom||l.bearing){const p=s.pinchAround===void 0?s.around:s.pinchAround;l.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),c.e(l,{noMoveStart:!0})}}function tr(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function ra(h,t,s){const{maxSpeed:n,linearity:l,deceleration:p}=s,m=c.ad(h*l/(t/1e3),-n,n),g=Math.abs(m)/(p*l);return{easing:s.easing,duration:1e3*g,amount:m*(g/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,n,l={}){const p=ie.mousePos(s.getCanvasContainer(),n),m=s.unproject(p);super(t,c.e({point:p,lngLat:m,originalEvent:n},l)),this._defaultPrevented=!1,this.target=s}}class sa extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,n){const l=t==="touchend"?n.changedTouches:n.touches,p=ie.touchPos(s.getCanvasContainer(),l),m=p.map(y=>s.unproject(y)),g=p.reduce((y,v,w,S)=>y.add(v.div(S.length)),new c.P(0,0));super(t,{points:p,point:g,lngLats:m,lngLat:s.unproject(g),originalEvent:n}),this._defaultPrevented=!1}}class Fo extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,n){super(t,{originalEvent:n}),this._defaultPrevented=!1}}class Oo{constructor(t,s){this._map=t,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Fo(t.type,this._map,t))}mousedown(t,s){return this._mousedownPos=s,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new sa(t.type,this._map,t))}touchmove(t){this._map.fire(new sa(t.type,this._map,t))}touchend(t){this._map.fire(new sa(t.type,this._map,t))}touchcancel(t){this._map.fire(new sa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mr{constructor(t){this._map=t}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(t){return this.transform.pointLocation(c.P.convert(t),this._map.terrain)}}class No{constructor(t,s){this._map=t,this._tr=new mr(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,s){this.isEnabled()&&t.shiftKey&&t.button===0&&(ie.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(t,s){if(!this._active)return;const n=s;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=n,this._box||(this._box=ie.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(l.x,n.x),m=Math.max(l.x,n.x),g=Math.min(l.y,n.y),y=Math.max(l.y,n.y);ie.setTransform(this._box,`translate(${p}px,${g}px)`),this._box.style.width=m-p+"px",this._box.style.height=y-g+"px"}mouseupWindow(t,s){if(!this._active||t.button!==0)return;const n=this._startPos,l=s;if(this.reset(),ie.suppressClick(),n.x!==l.x||n.y!==l.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(n,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,s){return this._map.fire(new c.k(t,{originalEvent:s}))}}function Oi(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const s={};for(let n=0;n<h.length;n++)s[h[n].identifier]=t[n];return s}class gr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,s,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(l){const p=new c.P(0,0);for(const m of l)p._add(m);return p.div(l.length)}(s),this.touches=Oi(n,s)))}touchmove(t,s,n){if(this.aborted||!this.centroid)return;const l=Oi(n,s);for(const p in this.touches){const m=l[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,s,n){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class $a{constructor(t){this.singleTap=new gr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,s,n){this.singleTap.touchstart(t,s,n)}touchmove(t,s,n){this.singleTap.touchmove(t,s,n)}touchend(t,s,n){const l=this.singleTap.touchend(t,s,n);if(l){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(l)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class _r{constructor(t){this._tr=new mr(t),this._zoomIn=new $a({numTouches:1,numTaps:2}),this._zoomOut=new $a({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,s,n){this._zoomIn.touchstart(t,s,n),this._zoomOut.touchstart(t,s,n)}touchmove(t,s,n){this._zoomIn.touchmove(t,s,n),this._zoomOut.touchmove(t,s,n)}touchend(t,s,n){const l=this._zoomIn.touchend(t,s,n),p=this._zoomOut.touchend(t,s,n),m=this._tr;return l?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(l)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const s=this._moveFunction(...t);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(t,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,s){if(!this.isEnabled())return;const n=this._lastPoint;if(!n)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const l=s.length?s[0]:s;return!this._moved&&l.dist(n)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(n,l))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ie.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ll={0:1,2:2};class Cn{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const s=ie.mouseButton(t);this._eventButton=s}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(s,n){const l=Ll[n];return s.buttons===void 0||(s.buttons&l)!==l}(t,this._eventButton)}isValidEndEvent(t){return ie.mouseButton(t)===this._eventButton}}class Uo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const ja=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=function(t){t.preventDefault()}},Cs=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:s=.8})=>{const n=new Cn({checkCorrectEvent:l=>ie.mouseButton(l)===0&&l.ctrlKey||ie.mouseButton(l)===2});return new yr({clickTolerance:t,move:(l,p)=>({bearingDelta:(p.x-l.x)*s}),moveStateManager:n,enable:h,assignEvents:ja})},xr=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:s=-.5})=>{const n=new Cn({checkCorrectEvent:l=>ie.mouseButton(l)===0&&l.ctrlKey||ie.mouseButton(l)===2});return new yr({clickTolerance:t,move:(l,p)=>({pitchDelta:(p.y-l.y)*s}),moveStateManager:n,enable:h,assignEvents:ja})};class we{constructor(t,s){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,s,n){return this._calculateTransform(t,s,n)}touchmove(t,s,n){if(this._map._cooperativeGestures&&(this._minTouches===2&&n.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,n.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(n.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,s,n)}touchend(t,s,n){this._calculateTransform(t,s,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,s,n){n.length>0&&(this._active=!0);const l=Oi(n,s),p=new c.P(0,0),m=new c.P(0,0);let g=0;for(const v in l){const w=l[v],S=this._touches[v];S&&(p._add(w),m._add(w.sub(S)),g++,l[v]=w)}if(this._touches=l,g<this._minTouches||!m.mag())return;const y=m.div(g);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(g),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,s,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([s[0],s[1]]))}touchmove(t,s,n){if(!this._firstTwoTouches)return;t.preventDefault();const[l,p]=this._firstTwoTouches,m=Rr(n,s,l),g=Rr(n,s,p);if(!m||!g)return;const y=this._aroundCenter?null:m.add(g).div(2);return this._move([m,g],y,t)}touchend(t,s,n){if(!this._firstTwoTouches)return;const[l,p]=this._firstTwoTouches,m=Rr(n,s,l),g=Rr(n,s,p);m&&g||(this._active&&ie.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Rr(h,t,s){for(let n=0;n<h.length;n++)if(h[n].identifier===s)return t[n]}function Ps(h,t){return Math.log(h/t)/Math.LN2}class $o extends qa{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,s){const n=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ps(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ps(this._distance,n),pinchAround:s}}}function ve(h,t){return 180*h.angleWith(t)/Math.PI}class Pn extends qa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,s){const n=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ve(this._vector,n),pinchAround:s}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const s=25/(Math.PI*this._minDiameter)*360,n=ve(t,this._startVector);return Math.abs(n)<s}}function kn(h){return Math.abs(h.y)>Math.abs(h.x)}class Bl extends qa{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,s,n){super.touchstart(t,s,n),this._currentTouchCount=n.length}_start(t){this._lastPoints=t,kn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,s,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const l=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,p,n.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(l.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,s,n){if(this._valid!==void 0)return this._valid;const l=t.mag()>=2,p=s.mag()>=2;if(!l&&!p)return;if(!l||!p)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;const m=t.y>0==s.y>0;return kn(t)&&kn(s)&&m}}const zn={panStep:100,bearingStep:15,pitchStep:10};class jo{constructor(t){this._tr=new mr(t);const s=zn;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let s=0,n=0,l=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?l=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?l=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(n=0,l=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:qo,zoom:s?Math.round(y.zoom)+s*(t.shiftKey?2:1):y.zoom,bearing:y.bearing+n*this._bearingStep,pitch:y.pitch+l*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.center},{originalEvent:t})}}}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 qo(h){return h*(2-h)}const Zo=4.000244140625;class Rl{constructor(t,s){this._onTimeout=n=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(n)},this._map=t,this._tr=new mr(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let s=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const n=c.h.now(),l=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,s!==0&&s%Zo==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(l*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),t.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=t,this._delta-=s,this._active||this._start(t)),t.preventDefault()}_start(t){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 s=ie.mousePos(this._el,t),n=this._tr;this._around=c.L.convert(this._aroundCenter?n.center:n.unproject(s)),this._aroundPoint=n.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const g=this._type==="wheel"&&Math.abs(this._delta)>Zo?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*g)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,n=this._startZoom,l=this._easing;let p,m=!1;if(this._type==="wheel"&&n&&l){const g=Math.min((c.h.now()-this._lastWheelEventTime)/200,1),y=l(g);p=c.B.number(n,s,y),g<1?this._frameId||(this._frameId=!0):m=!0}else p=s,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let s=c.bb;if(this._prevEase){const n=this._prevEase,l=(c.h.now()-n.start)/n.duration,p=n.easing(l+.01)-n.easing(l),m=.27/Math.sqrt(p*p+1e-4)*.01,g=Math.sqrt(.0729-m*m);s=c.ba(m,g,.25,1)}return this._prevEase={start:c.h.now(),duration:t,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Dn{constructor(t,s){this._clickZoom=t,this._tapZoom=s}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 Ln{constructor(t){this._tr=new mr(t),this.reset()}reset(){this._active=!1}dblclick(t,s){return t.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bn{constructor(){this._tap=new $a({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(t,s,n){if(!this._swipePoint)if(this._tapTime){const l=s[0],p=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(l)<30;p&&m?n.length>0&&(this._swipePoint=l,this._swipeTouch=n[0].identifier):this.reset()}else this._tap.touchstart(t,s,n)}touchmove(t,s,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const l=s[0],p=l.y-this._swipePoint.y;return this._swipePoint=l,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,s,n)}touchend(t,s,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{const l=this._tap.touchend(t,s,n);l&&(this._tapTime=t.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rn{constructor(t,s,n){this._el=t,this._mousePan=s,this._touchPan=n}enable(t){this._inertiaOptions=t||{},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 di{constructor(t,s,n){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=s,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Fr{constructor(t,s,n,l){this._el=t,this._touchZoom=s,this._touchRotate=n,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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()}}const aa=h=>h.zoom||h.drag||h.pitch||h.rotate;class Fn extends c.k{}function na(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class On{constructor(t,s){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,p)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=l.type==="renderFrame"?void 0:l,g={needsRenderFrame:!1},y={},v={},w=l.touches,S=w?this._getMapTouches(w):void 0,E=S?ie.touchPos(this._el,S):ie.mousePos(this._el,l);for(const{handlerName:F,handler:z,allowed:G}of this._handlers){if(!z.isEnabled())continue;let J;this._blockedByActive(v,G,F)?z.reset():z[p||l.type]&&(J=z[p||l.type](l,E,S),this.mergeHandlerResult(g,y,J,F,m),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||z.isActive())&&(v[F]=z)}const B={};for(const F in this._previousActiveHandlers)v[F]||(B[F]=m);this._previousActiveHandlers=v,(Object.keys(B).length||na(g))&&(this._changes.push([g,y,B]),this._triggerRenderFrame()),(Object.keys(v).length||na(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:L}=g;L&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],L(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ro(t),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,p,m]of this._listeners)ie.addEventListener(l,p,l===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,s,n]of this._listeners)ie.removeEventListener(t,s,t===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(t){const s=this._map,n=s.getCanvasContainer();this._add("mapEvent",new Oo(s,t));const l=s.boxZoom=new No(s,t);this._add("boxZoom",l),t.interactive&&t.boxZoom&&l.enable();const p=new _r(s),m=new Ln(s);s.doubleClickZoom=new Dn(m,p),this._add("tapZoom",p),this._add("clickZoom",m),t.interactive&&t.doubleClickZoom&&s.doubleClickZoom.enable();const g=new Bn;this._add("tapDragZoom",g);const y=s.touchPitch=new Bl(s);this._add("touchPitch",y),t.interactive&&t.touchPitch&&s.touchPitch.enable(t.touchPitch);const v=Cs(t),w=xr(t);s.dragRotate=new di(t,v,w),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",w,["mouseRotate"]),t.interactive&&t.dragRotate&&s.dragRotate.enable();const S=(({enable:G,clickTolerance:J})=>{const U=new Cn({checkCorrectEvent:X=>ie.mouseButton(X)===0&&!X.ctrlKey});return new yr({clickTolerance:J,move:(X,ee)=>({around:ee,panDelta:ee.sub(X)}),activateOnStart:!0,moveStateManager:U,enable:G,assignEvents:ja})})(t),E=new we(t,s);s.dragPan=new Rn(n,S,E),this._add("mousePan",S),this._add("touchPan",E,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&s.dragPan.enable(t.dragPan);const B=new Pn,L=new $o;s.touchZoomRotate=new Fr(n,L,B,g),this._add("touchRotate",B,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&s.touchZoomRotate.enable(t.touchZoomRotate);const F=s.scrollZoom=new Rl(s,()=>this._triggerRenderFrame());this._add("scrollZoom",F,["mousePan"]),t.interactive&&t.scrollZoom&&s.scrollZoom.enable(t.scrollZoom);const z=s.keyboard=new jo(s);this._add("keyboard",z),t.interactive&&t.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new Vo(s))}_add(t,s,n){this._handlers.push({handlerName:t,handler:s,allowed:n}),this._handlersById[t]=s}stop(t){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!aa(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,s,n){for(const l in t)if(l!==n&&(!s||s.indexOf(l)<0))return!0;return!1}_getMapTouches(t){const s=[];for(const n of t)this._el.contains(n.target)&&s.push(n);return s}mergeHandlerResult(t,s,n,l,p){if(!n)return;c.e(t,n);const m={handlerName:l,originalEvent:n.originalEvent||p};n.zoomDelta!==void 0&&(s.zoom=m),n.panDelta!==void 0&&(s.drag=m),n.pitchDelta!==void 0&&(s.pitch=m),n.bearingDelta!==void 0&&(s.rotate=m)}_applyChanges(){const t={},s={},n={};for(const[l,p,m]of this._changes)l.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(l.panDelta)),l.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+l.pitchDelta),l.around!==void 0&&(t.around=l.around),l.pinchAround!==void 0&&(t.pinchAround=l.pinchAround),l.noInertia&&(t.noInertia=l.noInertia),c.e(s,p),c.e(n,m);this._updateMapTransform(t,s,n),this._changes=[]}_updateMapTransform(t,s,n){const l=this._map,p=l._getTransformForUpdate(),m=l.terrain;if(!(na(t)||m&&this._terrainMovement))return this._fireEvents(s,n,!0);let{panDelta:g,zoomDelta:y,bearingDelta:v,pitchDelta:w,around:S,pinchAround:E}=t;E!==void 0&&(S=E),l._stop(!0),S=S||l.transform.centerPoint;const B=p.pointLocation(g?S.sub(g):S);v&&(p.bearing+=v),w&&(p.pitch+=w),y&&(p.zoom+=y),m?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(g)):p.setLocationAtPoint(B,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,p.setLocationAtPoint(B,S),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,p.recalculateZoom(l.terrain)})):p.setLocationAtPoint(B,S),l._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(s,n,!0)}_fireEvents(t,s,n){const l=aa(this._eventsInProgress),p=aa(t),m={};for(const w in t){const{originalEvent:S}=t[w];this._eventsInProgress[w]||(m[`${w}start`]=S),this._eventsInProgress[w]=t[w]}!l&&p&&this._fireEvent("movestart",p.originalEvent);for(const w in m)this._fireEvent(w,m[w]);p&&this._fireEvent("move",p.originalEvent);for(const w in t){const{originalEvent:S}=t[w];this._fireEvent(w,S)}const g={};let y;for(const w in this._eventsInProgress){const{handlerName:S,originalEvent:E}=this._eventsInProgress[w];this._handlersById[S].isActive()||(delete this._eventsInProgress[w],y=s[S]||E,g[`${w}end`]=y)}for(const w in g)this._fireEvent(w,g[w]);const v=aa(this._eventsInProgress);if(n&&(l||p)&&!v){this._updatingCamera=!0;const w=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=E=>E!==0&&-this._bearingSnap<E&&E<this._bearingSnap;!w||!w.essential&&c.h.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:y})),S(this._map.getBearing())&&this._map.resetNorth()):(S(w.bearing||this._map.getBearing())&&(w.bearing=0),w.freezeElevation=!0,this._map.easeTo(w,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(t,s){this._map.fire(new c.k(t,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Fn("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Go extends c.E{constructor(t,s){super(),this._renderFrameCallback=()=>{const n=Math.min((c.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(n)),n<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=s.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,s){return this.jumpTo({center:t},s)}panBy(t,s,n){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},s),n)}panTo(t,s,n){return this.easeTo(c.e({center:t},s),n)}getZoom(){return this.transform.zoom}setZoom(t,s){return this.jumpTo({zoom:t},s),this}zoomTo(t,s,n){return this.easeTo(c.e({zoom:t},s),n)}zoomIn(t,s){return this.zoomTo(this.getZoom()+1,t,s),this}zoomOut(t,s){return this.zoomTo(this.getZoom()-1,t,s),this}getBearing(){return this.transform.bearing}setBearing(t,s){return this.jumpTo({bearing:t},s),this}getPadding(){return this.transform.padding}setPadding(t,s){return this.jumpTo({padding:t},s),this}rotateTo(t,s,n){return this.easeTo(c.e({bearing:t},s),n)}resetNorth(t,s){return this.rotateTo(0,c.e({duration:1e3},t),s),this}resetNorthPitch(t,s){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),s),this}snapToNorth(t,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,s):this}getPitch(){return this.transform.pitch}setPitch(t,s){return this.jumpTo({pitch:t},s),this}cameraForBounds(t,s){t=ct.convert(t);const n=s&&s.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),n,s)}_cameraForBoxAndBearing(t,s,n,l){const p={top:0,bottom:0,right:0,left:0};if(typeof(l=c.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const ee=l.padding;l.padding={top:ee,bottom:ee,right:ee,left:ee}}l.padding=c.e(p,l.padding);const m=this.transform,g=m.padding,y=m.project(c.L.convert(t)),v=m.project(c.L.convert(s)),w=y.rotate(-n*Math.PI/180),S=v.rotate(-n*Math.PI/180),E=new c.P(Math.max(w.x,S.x),Math.max(w.y,S.y)),B=new c.P(Math.min(w.x,S.x),Math.min(w.y,S.y)),L=E.sub(B),F=(m.width-(g.left+g.right+l.padding.left+l.padding.right))/L.x,z=(m.height-(g.top+g.bottom+l.padding.top+l.padding.bottom))/L.y;if(z<0||F<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const G=Math.min(m.scaleZoom(m.scale*Math.min(F,z)),l.maxZoom),J=c.P.convert(l.offset),U=new c.P((l.padding.left-l.padding.right)/2,(l.padding.top-l.padding.bottom)/2).rotate(n*Math.PI/180),X=J.add(U).mult(m.scale/m.zoomScale(G));return{center:m.unproject(y.add(v).div(2).sub(X)),zoom:G,bearing:n}}fitBounds(t,s,n){return this._fitInternal(this.cameraForBounds(t,s),s,n)}fitScreenCoordinates(t,s,n,l,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(s)),n,l),l,p)}_fitInternal(t,s,n){return t?(delete(s=c.e(t,s)).padding,s.linear?this.easeTo(s,n):this.flyTo(s,n)):this}jumpTo(t,s){this.stop();const n=this._getTransformForUpdate();let l=!1,p=!1,m=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(l=!0,n.zoom=+t.zoom),t.center!==void 0&&(n.center=c.L.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(p=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(m=!0,n.pitch=+t.pitch),t.padding==null||n.isPaddingEqual(t.padding)||(n.padding=t.padding),this._applyUpdatedTransform(n),this.fire(new c.k("movestart",s)).fire(new c.k("move",s)),l&&this.fire(new c.k("zoomstart",s)).fire(new c.k("zoom",s)).fire(new c.k("zoomend",s)),p&&this.fire(new c.k("rotatestart",s)).fire(new c.k("rotate",s)).fire(new c.k("rotateend",s)),m&&this.fire(new c.k("pitchstart",s)).fire(new c.k("pitch",s)).fire(new c.k("pitchend",s)),this.fire(new c.k("moveend",s))}calculateCameraOptionsFromTo(t,s,n,l=0){const p=c.U.fromLngLat(t,s),m=c.U.fromLngLat(n,l),g=m.x-p.x,y=m.y-p.y,v=m.z-p.z,w=Math.hypot(g,y,v);if(w===0)throw new Error("Can't calculate camera options with same From and To");const S=Math.hypot(g,y),E=this.transform.scaleZoom(this.transform.cameraToCenterDistance/w/this.transform.tileSize),B=180*Math.atan2(g,-y)/Math.PI;let L=180*Math.acos(S/w)/Math.PI;return L=v<0?90-L:90+L,{center:m.toLngLat(),zoom:E,pitch:L,bearing:B}}easeTo(t,s){this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.bb},t)).animate===!1||!t.essential&&c.h.prefersReducedMotion)&&(t.duration=0);const n=this._getTransformForUpdate(),l=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),y="zoom"in t?+t.zoom:l,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,w="pitch"in t?+t.pitch:m,S="padding"in t?t.padding:n.padding,E=c.P.convert(t.offset);let B=n.centerPoint.add(E);const L=n.pointLocation(B),F=c.L.convert(t.center||L);this._normalizeCenter(F);const z=n.project(L),G=n.project(F).sub(z),J=n.zoomScale(y-l);let U,X;t.around&&(U=c.L.convert(t.around),X=n.locationPoint(U));const ee={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==l,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||w!==m,this._padding=!n.isPaddingEqual(S),this._easeId=t.easeId,this._prepareEase(s,t.noMoveStart,ee),this.terrain&&this._prepareElevation(F),this._ease(te=>{if(this._zooming&&(n.zoom=c.B.number(l,y,te)),this._rotating&&(n.bearing=c.B.number(p,v,te)),this._pitching&&(n.pitch=c.B.number(m,w,te)),this._padding&&(n.interpolatePadding(g,S,te),B=n.centerPoint.add(E)),this.terrain&&!t.freezeElevation&&this._updateElevation(te),U)n.setLocationAtPoint(U,X);else{const ne=n.zoomScale(n.zoom-l),he=y>l?Math.min(2,J):Math.max(.5,J),ce=Math.pow(he,1-te),pe=n.unproject(z.add(G.mult(te*ce)).mult(ne));n.setLocationAtPoint(n.renderWorldCopies?pe.wrap():pe,B)}this._applyUpdatedTransform(n),this._fireMoveEvents(s)},te=>{this.terrain&&this._finalizeElevation(),this._afterEase(s,te)},t),this}_prepareEase(t,s,n={}){this._moving=!0,s||n.moving||this.fire(new c.k("movestart",t)),this._zooming&&!n.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new c.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&s!==this._elevationTarget){const n=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(n-(s-(n*t+this._elevationStart))/(1-t)),this._elevationTarget=s}this.transform.elevation=c.B.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const s=t.clone(),{center:n,zoom:l,pitch:p,bearing:m,elevation:g}=this.transformCameraUpdate(s);n&&(s.center=n),l!==void 0&&(s.zoom=l),p!==void 0&&(s.pitch=p),m!==void 0&&(s.bearing=m),g!==void 0&&(s.elevation=g),this.transform.apply(s)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const n=this._zooming,l=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new c.k("zoomend",t)),l&&this.fire(new c.k("rotateend",t)),p&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,s){if(!t.essential&&c.h.prefersReducedMotion){const Me=c.F(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Me,s)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.bb},t);const n=this._getTransformForUpdate(),l=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),y="zoom"in t?c.ad(+t.zoom,n.minZoom,n.maxZoom):l,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,w="pitch"in t?+t.pitch:m,S="padding"in t?t.padding:n.padding,E=n.zoomScale(y-l),B=c.P.convert(t.offset);let L=n.centerPoint.add(B);const F=n.pointLocation(L),z=c.L.convert(t.center||F);this._normalizeCenter(z);const G=n.project(F),J=n.project(z).sub(G);let U=t.curve;const X=Math.max(n.width,n.height),ee=X/E,te=J.mag();if("minZoom"in t){const Me=c.ad(Math.min(t.minZoom,l,y),n.minZoom,n.maxZoom),rt=X/n.zoomScale(Me-l);U=Math.sqrt(rt/te*2)}const ne=U*U;function he(Me){const rt=(ee*ee-X*X+(Me?-1:1)*ne*ne*te*te)/(2*(Me?ee:X)*ne*te);return Math.log(Math.sqrt(rt*rt+1)-rt)}function ce(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function pe(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Ie=he(!1);let qe=function(Me){return pe(Ie)/pe(Ie+U*Me)},_e=function(Me){return X*((pe(Ie)*(ce(rt=Ie+U*Me)/pe(rt))-ce(Ie))/ne)/te;var rt},Le=(he(!0)-Ie)/U;if(Math.abs(te)<1e-6||!isFinite(Le)){if(Math.abs(X-ee)<1e-6)return this.easeTo(t,s);const Me=ee<X?-1:1;Le=Math.abs(Math.log(ee/X))/U,_e=function(){return 0},qe=function(rt){return Math.exp(Me*U*rt)}}return t.duration="duration"in t?+t.duration:1e3*Le/("screenSpeed"in t?+t.screenSpeed/U:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=w!==m,this._padding=!n.isPaddingEqual(S),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(z),this._ease(Me=>{const rt=Me*Le,je=1/qe(rt);n.zoom=Me===1?y:l+n.scaleZoom(je),this._rotating&&(n.bearing=c.B.number(p,v,Me)),this._pitching&&(n.pitch=c.B.number(m,w,Me)),this._padding&&(n.interpolatePadding(g,S,Me),L=n.centerPoint.add(B)),this.terrain&&!t.freezeElevation&&this._updateElevation(Me);const Ne=Me===1?z:n.unproject(G.add(J.mult(_e(rt))).mult(je));n.setLocationAtPoint(n.renderWorldCopies?Ne.wrap():Ne,L),this._applyUpdatedTransform(n),this._fireMoveEvents(s)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(s)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,s){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,s)}if(!t){const n=this.handlers;n&&n.stop(!1)}return this}_ease(t,s,n){n.animate===!1||n.duration===0?(t(1),s()):(this._easeStart=c.h.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,s){t=c.b5(t,-180,180);const n=Math.abs(t-s);return Math.abs(t-360-s)<n&&(t-=360),Math.abs(t+360-s)<n&&(t+=360),t}_normalizeCenter(t){const s=this.transform;if(!s.renderWorldCopies||s.lngRange)return;const n=t.lng-s.center.lng;t.lng+=n>180?-360:n<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.L.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class Ii{constructor(t={}){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=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.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(){ie.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(t,s){const n=this._map._getUIString(`AttributionControl.${s}`);t.title=n,t.setAttribute("aria-label",n)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const s=this._map.style.sourceCaches;for(const l in s){const p=s[l];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(l=>String(l).trim()),t.sort((l,p)=>l.length-p.length),t=t.filter((l,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(l)>=0)return!1;return!0});const n=t.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ht{constructor(t={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const n=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("div","maplibregl-ctrl");const s=ie.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Za{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const s=++this._id;return this._queue.push({callback:t,id:s,cancelled:!1}),s}remove(t){const s=this._currentlyRunning,n=s?this._queue.concat(s):this._queue;for(const l of n)if(l.id===t)return void(l.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const n of s)if(!n.cancelled&&(n.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Vn={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var Xo=c.Q([{name:"a_pos3d",type:"Int16",components:3}]);class Wo extends c.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,s){this.sourceCache.update(t,s),this._renderableTilesKeys=[];const n={};for(const l of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))n[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.posMatrix=new Float64Array(16),c.aS(l.posMatrix,0,c.N,0,c.N,0,1),this._tiles[l.key]=new Pr(l,this.tileSize));for(const l in this._tiles)n[l]||delete this._tiles[l]}freeRtt(t){for(const s in this._tiles){const n=this._tiles[s];(!t||n.tileID.equals(t)||n.tileID.isChildOf(t)||t.isChildOf(n.tileID))&&(n.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const s={};for(const n of this._renderableTilesKeys){const l=this._tiles[n].tileID;if(l.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),c.aS(p.posMatrix,0,c.N,0,c.N,0,1),s[n]=p}else if(l.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=l.canonical.z-t.canonical.z,g=l.canonical.x-(l.canonical.x>>m<<m),y=l.canonical.y-(l.canonical.y>>m<<m),v=c.N>>m;c.aS(p.posMatrix,0,v,0,v,0,1),c.$(p.posMatrix,p.posMatrix,[-g*v,-y*v,0]),s[n]=p}else if(t.canonical.isChildOf(l.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-l.canonical.z,g=t.canonical.x-(t.canonical.x>>m<<m),y=t.canonical.y-(t.canonical.y>>m<<m),v=c.N>>m;c.aS(p.posMatrix,0,c.N,0,c.N,0,1),c.$(p.posMatrix,p.posMatrix,[g*v,y*v,0]),c.a0(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),s[n]=p}}return s}getSourceTile(t,s){const n=this.sourceCache._source;let l=t.overscaledZ-this.deltaZoom;if(l>n.maxzoom&&(l=n.maxzoom),l<n.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(l).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&s)for(;l>=n.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(l--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(s=>s.timeAdded>=t)}}class Ho{constructor(t,s,n){this.painter=t,this.sourceCache=new Wo(s),this.options=n,this.exaggeration=typeof n.exaggeration=="number"?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,s,n,l=c.N){var p;if(!(s>=0&&s<l&&n>=0&&n<l))return 0;const m=this.getTerrainData(t),g=(p=m.tile)===null||p===void 0?void 0:p.dem;if(!g)return 0;const y=function(L,F,z){var G=F[0],J=F[1];return L[0]=z[0]*G+z[4]*J+z[12],L[1]=z[1]*G+z[5]*J+z[13],L}([],[s/l*c.N,n/l*c.N],m.u_terrain_matrix),v=[y[0]*g.dim,y[1]*g.dim],w=Math.floor(v[0]),S=Math.floor(v[1]),E=v[0]-w,B=v[1]-S;return g.get(w,S)*(1-E)*(1-B)+g.get(w+1,S)*E*(1-B)+g.get(w,S+1)*(1-E)*B+g.get(w+1,S+1)*E*B}getElevationForLngLatZoom(t,s){const{tileID:n,mercatorX:l,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(t,s);return this.getElevation(n,l%c.N,p%c.N,c.N)}getElevation(t,s,n,l=c.N){return this.getDEMElevation(t,s,n,l)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const l=this.painter.context,p=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new mt(l,p,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new mt(l,new c.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const s=this.sourceCache.getSourceTile(t,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){const l=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new mt(l,s.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),s.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}const n=s&&s+s.tileID.key+t.key;if(n&&!this._demMatrixCache[n]){const l=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-s.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=l?p=t.canonical.z-l:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),g=t.canonical.y-(t.canonical.y>>p<<p),y=c.bc(new Float64Array(16),[1/(c.N<<p),1/(c.N<<p),0]);c.$(y,y,[m*c.N,g*c.N,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:s&&s.dem&&s.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(s&&s.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:s}}getFramebuffer(t){const s=this.painter,n=s.width/devicePixelRatio,l=s.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new mt(s.context,{width:n,height:l,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new mt(s.context,{width:n,height:l,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=s.context.createFramebuffer(n,l,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.context.gl.DEPTH_COMPONENT16,n,l))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let g=0;g<this._coordsTextureSize;g++,m+=4)s[m+0]=255&g,s[m+1]=255&p,s[m+2]=g>>8<<4|p>>8,s[m+3]=0;const n=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),l=new mt(t,n,t.gl.RGBA,{premultiply:!1});return l.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(t){const s=new Uint8Array(4),n=this.painter.context,l=n.gl;n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,s),n.bindFramebuffer.set(null);const p=s[0]+(s[2]>>4<<8),m=s[1]+((15&s[2])<<8),g=this.coordsIndex[255-s[3]],y=g&&this.sourceCache.getTileByID(g);if(!y)return null;const v=this._coordsTextureSize,w=(1<<y.tileID.canonical.z)*v;return new c.U(this._allowMercatorOverflow(t,(y.tileID.canonical.x*v+p)/w),(y.tileID.canonical.y*v+m)/w,this.getElevation(y.tileID,p,m,v))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,s=new c.bd,n=new c.b0,l=this.meshSize,p=c.N/l,m=l*l;for(let S=0;S<=l;S++)for(let E=0;E<=l;E++)s.emplaceBack(E*p,S*p,0);for(let S=0;S<m;S+=l+1)for(let E=0;E<l;E++)n.emplaceBack(E+S,l+E+S+1,l+E+S+2),n.emplaceBack(E+S,l+E+S+2,E+S+1);const g=s.length,y=g+2*(l+1);for(const S of[0,1])for(let E=0;E<=l;E++)for(const B of[0,1])s.emplaceBack(E*p,S*c.N,B);for(let S=0;S<2*l;S+=2)n.emplaceBack(y+S,y+S+1,y+S+3),n.emplaceBack(y+S,y+S+3,y+S+2),n.emplaceBack(g+S,g+S+3,g+S+1),n.emplaceBack(g+S,g+S+2,g+S+3);const v=s.length,w=v+2*(l+1);for(const S of[0,1])for(let E=0;E<=l;E++)for(const B of[0,1])s.emplaceBack(S*c.N,E*p,B);for(let S=0;S<2*l;S+=2)n.emplaceBack(v+S,v+S+1,v+S+3),n.emplaceBack(v+S,v+S+3,v+S+2),n.emplaceBack(w+S,w+S+3,w+S+1),n.emplaceBack(w+S,w+S+2,w+S+3);return this._mesh={indexBuffer:t.createIndexBuffer(n),vertexBuffer:t.createVertexBuffer(s,Xo.members),segments:c.S.simpleSegment(0,0,s.length,n.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.be/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,s){var n;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(t,s);return(n=this.getMinMaxElevation(l).minElevation)!==null&&n!==void 0?n:0}getMinMaxElevation(t){const s=this.getTerrainData(t).tile,n={minElevation:null,maxElevation:null};return s&&s.dem&&(n.minElevation=s.dem.min*this.exaggeration,n.maxElevation=s.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(t,s){const n=c.U.fromLngLat(t.wrap()),l=(1<<s)*c.N,p=n.x*l,m=n.y*l,g=Math.floor(p/c.N),y=Math.floor(m/c.N);return{tileID:new c.O(s,0,s,g,y),mercatorX:p,mercatorY:m}}_allowMercatorOverflow(t,s){const n=t.x<this.painter.width/2;let l=c.bf(s);const p=this.painter.transform.center.lng;return n&&Math.sign(l)>0&&Math.sign(p)<0||!n&&Math.sign(l)<0&&Math.sign(p)>0?(l=360*Math.sign(p)+l,c.G(l)):s}}class Fl{constructor(t,s,n){this._context=t,this._size=s,this._tileSize=n,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const s=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new mt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),s.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),s.colorAttachment.set(n.texture),{id:t,fbo:s,texture:n,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(s=>t.id!==s),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const ri={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ga{constructor(t,s){this.painter=t,this.terrain=s,this.pool=new Fl(t.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(n=>!t._layers[n].isHidden(s)),this._coordsDescendingInv={};for(const n in t.sourceCaches){this._coordsDescendingInv[n]={};const l=t.sourceCaches[n].getVisibleCoordinates();for(const p of l){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const g in m)this._coordsDescendingInv[n][g]||(this._coordsDescendingInv[n][g]=[]),this._coordsDescendingInv[n][g].push(m[g])}}this._coordsDescendingInvStr={};for(const n of t._order){const l=t._layers[n],p=l.source;if(ri[l.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(g=>g.key).sort().join()}}for(const n of this._renderableTiles)for(const l in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[l][n.tileID.key];p&&p!==n.rttCoords[l]&&(n.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const s=t.type,n=this.painter,l=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(ri[s]&&(this._prevType&&ri[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(t.id),!l))return!0;if(ri[this._prevType]||ri[s]&&l){this._prevType=s;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(wt(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[p]){const v=this.pool.getObjectForId(g.rtt[p].id);if(v.stamp===g.rtt[p].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[p]={id:y.id,stamp:y.stamp},n.context.bindFramebuffer.set(y.fbo.framebuffer),n.context.clear({color:c.aT.transparent,stencil:0}),n.currentStencilSource=void 0;for(let v=0;v<m.length;v++){const w=n.style._layers[m[v]],S=w.source?this._coordsDescendingInv[w.source][g.tileID.key]:[g.tileID];n.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),n._renderTileClippingMasks(w,S),n.renderLayer(n,n.style.sourceCaches[w.source],w,S),w.source&&(g.rttCoords[w.source]=this._coordsDescendingInvStr[w.source][g.tileID.key])}}return wt(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),ri[s]}return!1}}const Ce=Wi,De={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.c.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},oa=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},Nn={showCompass:!0,showZoom:!0,visualizePitch:!1};class Un{constructor(t,s,n=!1){this.mousedown=m=>{this.startMouse(c.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ie.mousePos(this.element,m)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ie.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ie.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ie.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ie.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const l=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Cs({clickTolerance:l,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const v=new Uo;return new yr({clickTolerance:g,move:(w,S)=>({bearingDelta:(S.x-w.x)*y}),moveStateManager:v,enable:m,assignEvents:oa})})({clickTolerance:l,enable:!0}),this.map=t,n&&(this.mousePitch=xr({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new Uo;return new yr({clickTolerance:g,move:(w,S)=>({pitchDelta:(S.y-w.y)*y}),moveStateManager:v,enable:m,assignEvents:oa})})({clickTolerance:p,enable:!0})),ie.addEventListener(s,"mousedown",this.mousedown),ie.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(s,"touchcancel",this.reset)}startMouse(t,s){this.mouseRotate.dragStart(t,s),this.mousePitch&&this.mousePitch.dragStart(t,s),ie.disableDrag()}startTouch(t,s){this.touchRotate.dragStart(t,s),this.touchPitch&&this.touchPitch.dragStart(t,s),ie.disableDrag()}moveMouse(t,s){const n=this.map,{bearingDelta:l}=this.mouseRotate.dragMove(t,s)||{};if(l&&n.setBearing(n.getBearing()+l),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,s)||{};p&&n.setPitch(n.getPitch()+p)}}moveTouch(t,s){const n=this.map,{bearingDelta:l}=this.touchRotate.dragMove(t,s)||{};if(l&&n.setBearing(n.getBearing()+l),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,s)||{};p&&n.setPitch(n.getPitch()+p)}}off(){const t=this.element;ie.removeEventListener(t,"mousedown",this.mousedown),ie.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend),ie.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend)}}let Mt;function $n(h,t,s){if(h=new c.L(h.lng,h.lat),t){const n=new c.L(h.lng-360,h.lat),l=new c.L(h.lng+360,h.lat),p=s.locationPoint(h).distSqr(t);s.locationPoint(n).distSqr(t)<p?h=n:s.locationPoint(l).distSqr(t)<p&&(h=l)}for(;Math.abs(h.lng-s.center.lng)>180;){const n=s.locationPoint(h);if(n.x>=0&&n.y>=0&&n.x<=s.width&&n.y<=s.height)break;h.lng>s.center.lng?h.lng-=360:h.lng+=360}return h}const Vi={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 Ko(h,t,s){const n=h.classList;for(const l in Vi)n.remove(`maplibregl-${s}-anchor-${l}`);n.add(`maplibregl-${s}-anchor-${t}`)}class ts extends c.E{constructor(t){if(super(),this._onKeyPress=s=>{const n=s.code,l=s.charCode||s.keyCode;n!=="Space"&&n!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=s=>{const n=s.originalEvent.target,l=this._element;this._popup&&(n===l||l.contains(n))&&this.togglePopup()},this._update=s=>{if(!this._map)return;const n=this._map.loaded()&&!this._map.isMoving();((s==null?void 0:s.type)==="terrain"||(s==null?void 0:s.type)==="render"&&!n)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=$n(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),s&&s.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${Vi[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${l}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const m=this._map.unproject(this._pos),g=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=m.distanceTo(this._lngLat)>20*g?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=s=>{if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=s.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.k("dragstart"))),this.fire(new c.k("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.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ie.createNS("http://www.w3.org/2000/svg","svg"),n=41,l=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${n}px`),s.setAttributeNS(null,"width",`${l}px`),s.setAttributeNS(null,"viewBox",`0 0 ${l} ${n}`);const p=ie.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"stroke","none"),p.setAttributeNS(null,"stroke-width","1"),p.setAttributeNS(null,"fill","none"),p.setAttributeNS(null,"fill-rule","evenodd");const m=ie.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=ie.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.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 G of y){const J=ie.createNS("http://www.w3.org/2000/svg","ellipse");J.setAttributeNS(null,"opacity","0.04"),J.setAttributeNS(null,"cx","10.5"),J.setAttributeNS(null,"cy","5.80029008"),J.setAttributeNS(null,"rx",G.rx),J.setAttributeNS(null,"ry",G.ry),g.appendChild(J)}const v=ie.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const w=ie.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 S=ie.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const E=ie.createNS("http://www.w3.org/2000/svg","path");E.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"),S.appendChild(E);const B=ie.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const L=ie.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(8.0, 8.0)");const F=ie.createNS("http://www.w3.org/2000/svg","circle");F.setAttributeNS(null,"fill","#000000"),F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"cx","5.5"),F.setAttributeNS(null,"cy","5.5"),F.setAttributeNS(null,"r","5.4999962");const z=ie.createNS("http://www.w3.org/2000/svg","circle");z.setAttributeNS(null,"fill","#FFFFFF"),z.setAttributeNS(null,"cx","5.5"),z.setAttributeNS(null,"cy","5.5"),z.setAttributeNS(null,"r","5.4999962"),L.appendChild(F),L.appendChild(z),m.appendChild(g),m.appendChild(v),m.appendChild(S),m.appendChild(B),m.appendChild(L),s.appendChild(m),s.setAttributeNS(null,"height",n*this._scale+"px"),s.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(s),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Ko(this._element,this._anchor,"marker"),t&&t.className)for(const s of t.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",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("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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.L.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const l=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const St={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xt=0,ks=!1;const la={maxWidth:100,unit:"metric"};function ca(h,t,s){const n=s&&s.maxWidth||100,l=h._container.clientHeight/2,p=h.unproject([0,l]),m=h.unproject([n,l]),g=p.distanceTo(m);if(s&&s.unit==="imperial"){const y=3.2808*g;y>5280?is(t,n,y/5280,h._getUIString("ScaleControl.Miles")):is(t,n,y,h._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?is(t,n,g/1852,h._getUIString("ScaleControl.NauticalMiles")):g>=1e3?is(t,n,g/1e3,h._getUIString("ScaleControl.Kilometers")):is(t,n,g,h._getUIString("ScaleControl.Meters"))}function is(h,t,s,n){const l=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let g=p/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(g),m*g}(s);h.style.width=t*(l/s)+"px",h.innerHTML=`${l} ${n}`}const jn={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},qn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function zs(h){if(h){if(typeof h=="number"){const t=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(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-h),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(h,0),right:new c.P(-h,0)}}if(h instanceof c.P||Array.isArray(h)){const t=c.P.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}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 zs(new c.P(0,0))}const Zn={extend:(h,...t)=>c.e(h,...t),run(h){h()},logToElement(h,t=!1,s="log"){const n=window.document.getElementById(s);n&&(t&&(n.innerHTML=""),n.innerHTML+=`<br>${h}`)}},Gn=Wi;class et{static get version(){return Gn}static get workerCount(){return Ji.workerCount}static set workerCount(t){Ji.workerCount=t}static get maxParallelImageRequests(){return c.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){c.c.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return c.c.WORKER_URL}static set workerUrl(t){c.c.WORKER_URL=t}static addProtocol(t,s){c.c.REGISTERED_PROTOCOLS[t]=s}static removeProtocol(t){delete c.c.REGISTERED_PROTOCOLS[t]}}return et.Map=class extends Go{constructor(h){if(c.bg.mark(c.bh.create),(h=c.e({},De,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ua(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._cooperativeGestures=h.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new Za,this._controls=[],this._mapId=c.a2(),this._locale=c.e({},Vn,h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this.transformCameraUpdate=h.transformCameraUpdate,this._imageQueueHandle=ei.addThrottleControl(()=>this.isMoving()),this._requestManager=new ma(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.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 t=!1;const s=es(n=>{this._trackResize&&!this._removed&&this.resize(n)._update()},50);this._resizeObserver=new ResizeObserver(n=>{t?s(n):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new On(this,h),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=h.hash&&new ia(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,c.e({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new Ii({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new ht,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new c.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new c.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new c.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=h.onAdd(this);this._controls.push(h);const n=this._controlPositions[t];return t.indexOf("bottom")!==-1?n.insertBefore(s,n.firstChild):n.appendChild(s),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,t,s,n){return n==null&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,s,n)}resize(h){var t;const s=this._containerDimensions(),n=s[0],l=s[1],p=this._getClampedPixelRatio(n,l);if(this._resizeCanvas(n,l,p),this.painter.resize(n,l,p),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(n,l);this._resizeCanvas(n,l,y),this.painter.resize(n,l,y)}this.transform.resize(n,l),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,l);const m=!this._moving;return m&&(this.stop(),this.fire(new c.k("movestart",h)).fire(new c.k("move",h))),this.fire(new c.k("resize",h)),m&&this.fire(new c.k("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:s,1:n}=this._maxCanvasSize,l=this.getPixelRatio(),p=h*l,m=t*l;return Math.min(p>s?s/p:1,m>n?n/m:1)*l}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(ct.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=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.maxZoom=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.minPitch=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)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=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.renderWorldCopies=h,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(h){return this._cooperativeGestures=h,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(h){return this.transform.locationPoint(c.L.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(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,t,s){if(h==="mouseenter"||h==="mouseover"){let n=!1;return{layer:t,listener:s,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?n||(n=!0,s.call(this,new Ti(h,this,p.originalEvent,{features:m}))):n=!1},mouseout:()=>{n=!1}}}}if(h==="mouseleave"||h==="mouseout"){let n=!1;return{layer:t,listener:s,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?n=!0:n&&(n=!1,s.call(this,new Ti(h,this,m.originalEvent)))},mouseout:m=>{n&&(n=!1,s.call(this,new Ti(h,this,m.originalEvent)))}}}}{const n=l=>{const p=this.getLayer(t)?this.queryRenderedFeatures(l.point,{layers:[t]}):[];p.length&&(l.features=p,s.call(this,l),delete l.features)};return{layer:t,listener:s,delegates:{[h]:n}}}}on(h,t,s){if(s===void 0)return super.on(h,t);const n=this._createDelegatedListener(h,t,s);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(n);for(const l in n.delegates)this.on(l,n.delegates[l]);return this}once(h,t,s){if(s===void 0)return super.once(h,t);const n=this._createDelegatedListener(h,t,s);for(const l in n.delegates)this.once(l,n.delegates[l]);return this}off(h,t,s){return s===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(n=>{const l=this._delegatedListeners[h];for(let p=0;p<l.length;p++){const m=l[p];if(m.layer===t&&m.listener===s){for(const g in m.delegates)this.off(g,m.delegates[g]);return l.splice(p,1),this}}})(),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let s;const n=h instanceof c.P||Array.isArray(h),l=n?h:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(n?{}:h)||{},l instanceof c.P||typeof l[0]=="number")s=[c.P.convert(l)];else{const p=c.P.convert(l[0]),m=c.P.convert(l[1]);s=[p,new c.P(m.x,p.y),m,new c.P(p.x,m.y),p]}return this.style.queryRenderedFeatures(s,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(h,t))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const t=this._locale[h];if(t==null)throw new Error(`Missing UI string '${h}'`);return t}_updateStyle(h,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,t));const s=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new qt(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,s):this.style.loadJSON(h,t,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new qt(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const s=this._requestManager.transformRequest(h,Pt.Style);c.f(s,(n,l)=>{n?this.fire(new c.j(n)):l&&this._updateDiff(l,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(s){c.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}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,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new c.j(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 t=this.style.sourceCaches[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);for(const s in this.style._layers){const n=this.style._layers[s];n.type==="hillshade"&&n.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.")}this.terrain=new Ho(this.painter,t,h),this.painter.renderToTexture=new Ga(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==h.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(s.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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const s=h[t]._tiles;for(const n in s){const l=s[n];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}addSourceType(h,t,s){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,s)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,s={}){const{pixelRatio:n=1,sdf:l=!1,stretchX:p,stretchY:m,content:g}=s;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.a(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.j(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:y,height:v,data:w}=t,S=t;return this.style.addImage(h,{data:new c.R({width:y,height:v},new Uint8Array(w)),pixelRatio:n,stretchX:p,stretchY:m,content:g,sdf:l,version:0,userImage:S}),S.onAdd&&S.onAdd(this,h),this}}{const{width:y,height:v,data:w}=c.h.getImageData(t);this.style.addImage(h,{data:new c.R({width:y,height:v},w),pixelRatio:n,stretchX:p,stretchY:m,content:g,sdf:l,version:0})}}updateImage(h,t){const s=this.style.getImage(h);if(!s)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=t instanceof HTMLImageElement||c.a(t)?c.h.getImageData(t):t,{width:l,height:p,data:m}=n;if(l===void 0||p===void 0)return this.fire(new c.j(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(l!==s.data.width||p!==s.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(t instanceof HTMLImageElement||c.a(t));return s.data.replace(m,g),this.style.updateImage(h,s),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){ei.getImage(this._requestManager.transformRequest(h,Pt.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),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,t,s){return this.style.setLayerZoomRange(h,t,s),this._update(!0)}setFilter(h,t,s={}){return this.style.setFilter(h,t,s),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,s,n={}){return this.style.setPaintProperty(h,t,s,n),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,s,n={}){return this.style.setLayoutProperty(h,t,s,n),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,s,n=>{n||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,s=>{s||this._update(!0)}),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),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,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=ie.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ie.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),n=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],n);const l=this._controlContainer=ie.create("div","maplibregl-control-container",h),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{p[m]=ie.create("div",`maplibregl-ctrl-${m} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=ie.create("div","maplibregl-cooperative-gesture-screen",this._container);let h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
|
|
578
578
|
<div class="maplibregl-desktop-message">${h}</div>
|
|
579
579
|
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
580
|
-
`,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){ie.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,s){this._canvas.width=Math.floor(s*h),this._canvas.height=Math.floor(s*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",n=>{t={requestedAttributes:h},n&&(t.statusMessage=n.statusMessage,t.type=n.type)},{once:!0});const s=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!s){const n="Failed to initialize WebGL";throw t?(t.message=n,new Error(JSON.stringify(t))):new Error(n)}this.painter=new Qr(s,this.transform),Hi.testSupport(s)}_onCooperativeGesture(h,t,s){return!t&&s<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}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){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const l=this.transform.zoom,p=c.h.now();this.style.zoomHistory.update(l,p);const m=new c.a8(l,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(s=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bg.mark(c.bh.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||n||(this._fullyLoaded=!0,c.bg.mark(c.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const s of this._controls)s.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ei.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.bg.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.h.frame(h=>{c.bg.frame(h),this._frame=null,this._render(h)}))}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 Ce}getCameraTargetElevation(){return this.transform.elevation}},et.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),s=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,s)=>{const n=this._map._getUIString(`NavigationControl.${s}`);t.title=n,t.setAttribute("aria-label",n)},this.options=c.e({},Nn,h),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ie.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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Un(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const s=ie.create("button",h,this._container);return s.type="button",s.addEventListener("click",t),s}},et.GeolocateControl=class extends c.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const s=new c.L(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,l=this._map.getBearing(),p=c.e({bearing:l},this.options.fitBoundsOptions),m=ct.fromLngLat(s,n);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const s=new c.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=t.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=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&ks)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ts({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ts({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.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.k("trackuserlocationend")))})}},this.options=c.e({},St,h)}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,s=!1){Mt===void 0||s?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Mt=n.state!=="denied",t(Mt)}).catch(()=>{Mt=!!window.navigator.geolocation,t(Mt)}):(Mt=!!window.navigator.geolocation,t(Mt)):t(Mt)}(this._setupUI),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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xt=0,ks=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),s=h.coords;return t&&(s.longitude<t.getWest()||s.longitude>t.getEast()||s.latitude<t.getSouth()||s.latitude>t.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(),t=h.getSouthEast(),s=h.getNorthEast(),n=t.distanceTo(s),l=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}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.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xt--,ks=!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.k("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.k("trackuserlocationstart"));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"),xt++,xt>1?(h={maximumAge:6e5,timeout:0},ks=!0):(h=this.options.positionOptions,ks=!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)}},et.AttributionControl=Ii,et.LogoControl=ht,et.ScaleControl=class{constructor(h){this._onMove=()=>{ca(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ca(this._map,this._container,this.options)},this.options=c.e({},la,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},et.FullscreenControl=class extends c.E{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.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.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},et.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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},et.Popup=class extends c.E{constructor(h){super(),this.remove=()=>(this._content&&ie.remove(this._content),this._container&&(ie.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),delete this._map),this.fire(new c.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=$n(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const s=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let n=this.options.anchor;const l=zs(this.options.offset);if(!n){const m=this._container.offsetWidth,g=this._container.offsetHeight;let y;y=s.y+l.bottom.y<g?["top"]:s.y>this._map.transform.height-g?["bottom"]:[],s.x<m/2?y.push("left"):s.x>this._map.transform.width-m/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const p=s.add(l[n]).round();ie.setTransform(this._container,`${Vi[n]} translate(${p.x}px,${p.y}px)`),Ko(this._container,n,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(jn),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.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.L.convert(h),this._pos=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._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 t=document.createDocumentFragment(),s=document.createElement("body");let n;for(s.innerHTML=h;n=s.firstChild,n;)t.appendChild(n);return this.setDOMContent(t)}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=ie.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(qn);h&&h.focus()}},et.Marker=ts,et.Style=qt,et.LngLat=c.L,et.LngLatBounds=ct,et.Point=c.P,et.MercatorCoordinate=c.U,et.Evented=c.E,et.AJAXError=c.bi,et.config=c.c,et.CanvasSource=Er,et.GeoJSONSource=Mr,et.ImageSource=zi,et.RasterDEMTileSource=gs,et.RasterTileSource=ms,et.VectorTileSource=qr,et.VideoSource=Gs,et.setRTLTextPlugin=c.bj,et.getRTLTextPluginStatus=c.bk,et.prewarm=function(){ya().acquire(Ye)},et.clearPrewarmedResources=function(){const h=pr;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Ye),pr=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()"))},Zn.extend(et,{isSafari:c.ac,getPerformanceMetrics:c.bg.getPerformanceMetrics}),et});var du=$r;return du})})(cu.__module);var uu=cu.__module.exports;const pu=lu.getDefaultExportFromCjs(uu),cd=ld({__proto__:null,default:pu},[uu]);exports.Bl=cd;exports.default=pu;
|
|
580
|
+
`,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){ie.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,s){this._canvas.width=Math.floor(s*h),this._canvas.height=Math.floor(s*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",n=>{t={requestedAttributes:h},n&&(t.statusMessage=n.statusMessage,t.type=n.type)},{once:!0});const s=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!s){const n="Failed to initialize WebGL";throw t?(t.message=n,new Error(JSON.stringify(t))):new Error(n)}this.painter=new Qr(s,this.transform),Hi.testSupport(s)}_onCooperativeGesture(h,t,s){return!t&&s<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}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){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const l=this.transform.zoom,p=c.h.now();this.style.zoomHistory.update(l,p);const m=new c.a8(l,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(s=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bg.mark(c.bh.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||n||(this._fullyLoaded=!0,c.bg.mark(c.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const s of this._controls)s.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ei.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.bg.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.h.frame(h=>{c.bg.frame(h),this._frame=null,this._render(h)}))}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 Ce}getCameraTargetElevation(){return this.transform.elevation}},et.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),s=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,s)=>{const n=this._map._getUIString(`NavigationControl.${s}`);t.title=n,t.setAttribute("aria-label",n)},this.options=c.e({},Nn,h),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ie.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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Un(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const s=ie.create("button",h,this._container);return s.type="button",s.addEventListener("click",t),s}},et.GeolocateControl=class extends c.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const s=new c.L(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,l=this._map.getBearing(),p=c.e({bearing:l},this.options.fitBoundsOptions),m=ct.fromLngLat(s,n);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const s=new c.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=t.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=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&ks)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ts({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ts({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.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.k("trackuserlocationend")))})}},this.options=c.e({},St,h)}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,s=!1){Mt===void 0||s?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Mt=n.state!=="denied",t(Mt)}).catch(()=>{Mt=!!window.navigator.geolocation,t(Mt)}):(Mt=!!window.navigator.geolocation,t(Mt)):t(Mt)}(this._setupUI),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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xt=0,ks=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),s=h.coords;return t&&(s.longitude<t.getWest()||s.longitude>t.getEast()||s.latitude<t.getSouth()||s.latitude>t.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(),t=h.getSouthEast(),s=h.getNorthEast(),n=t.distanceTo(s),l=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}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.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xt--,ks=!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.k("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.k("trackuserlocationstart"));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"),xt++,xt>1?(h={maximumAge:6e5,timeout:0},ks=!0):(h=this.options.positionOptions,ks=!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)}},et.AttributionControl=Ii,et.LogoControl=ht,et.ScaleControl=class{constructor(h){this._onMove=()=>{ca(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ca(this._map,this._container,this.options)},this.options=c.e({},la,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},et.FullscreenControl=class extends c.E{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.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.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},et.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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},et.Popup=class extends c.E{constructor(h){super(),this.remove=()=>(this._content&&ie.remove(this._content),this._container&&(ie.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),delete this._map),this.fire(new c.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=$n(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const s=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let n=this.options.anchor;const l=zs(this.options.offset);if(!n){const m=this._container.offsetWidth,g=this._container.offsetHeight;let y;y=s.y+l.bottom.y<g?["top"]:s.y>this._map.transform.height-g?["bottom"]:[],s.x<m/2?y.push("left"):s.x>this._map.transform.width-m/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const p=s.add(l[n]).round();ie.setTransform(this._container,`${Vi[n]} translate(${p.x}px,${p.y}px)`),Ko(this._container,n,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(jn),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.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.L.convert(h),this._pos=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._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 t=document.createDocumentFragment(),s=document.createElement("body");let n;for(s.innerHTML=h;n=s.firstChild,n;)t.appendChild(n);return this.setDOMContent(t)}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=ie.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(qn);h&&h.focus()}},et.Marker=ts,et.Style=qt,et.LngLat=c.L,et.LngLatBounds=ct,et.Point=c.P,et.MercatorCoordinate=c.U,et.Evented=c.E,et.AJAXError=c.bi,et.config=c.c,et.CanvasSource=Er,et.GeoJSONSource=Mr,et.ImageSource=zi,et.RasterDEMTileSource=gs,et.RasterTileSource=ms,et.VectorTileSource=qr,et.VideoSource=Gs,et.setRTLTextPlugin=c.bj,et.getRTLTextPluginStatus=c.bk,et.prewarm=function(){ya().acquire(Ye)},et.clearPrewarmedResources=function(){const h=pr;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Ye),pr=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()"))},Zn.extend(et,{isSafari:c.ac,getPerformanceMetrics:c.bg.getPerformanceMetrics}),et});var du=$r;return du})})(cu.__module);var uu=cu.__module.exports;const pu=lu.getDefaultExportFromCjs(uu),cd=ld({__proto__:null,default:pu},[uu]);exports.default=pu;exports.on=cd;
|
|
581
581
|
//# sourceMappingURL=index.cjs19.js.map
|