@dartcom/ui-kit 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1335) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.js +0 -2
  2. package/dist/cjs/_virtual/_commonjsHelpers.js.map +1 -1
  3. package/dist/cjs/_virtual/index.js +5 -3
  4. package/dist/cjs/_virtual/index.js.map +1 -1
  5. package/dist/cjs/_virtual/index2.js +3 -3
  6. package/dist/cjs/_virtual/index3.js +2 -6
  7. package/dist/cjs/_virtual/index3.js.map +1 -1
  8. package/dist/cjs/_virtual/index4.js +0 -2
  9. package/dist/cjs/_virtual/index4.js.map +1 -1
  10. package/dist/cjs/_virtual/index5.js +2 -8
  11. package/dist/cjs/_virtual/index5.js.map +1 -1
  12. package/dist/cjs/_virtual/index6.js +2 -4
  13. package/dist/cjs/_virtual/index6.js.map +1 -1
  14. package/dist/cjs/_virtual/react-is.development.js +0 -2
  15. package/dist/cjs/_virtual/react-is.development.js.map +1 -1
  16. package/dist/cjs/_virtual/react-is.development2.js +0 -2
  17. package/dist/cjs/_virtual/react-is.development2.js.map +1 -1
  18. package/dist/cjs/_virtual/react-is.development3.js +0 -2
  19. package/dist/cjs/_virtual/react-is.development3.js.map +1 -1
  20. package/dist/cjs/_virtual/react-is.production.js +0 -2
  21. package/dist/cjs/_virtual/react-is.production.js.map +1 -1
  22. package/dist/cjs/_virtual/react-is.production.min.js +0 -2
  23. package/dist/cjs/_virtual/react-is.production.min.js.map +1 -1
  24. package/dist/cjs/_virtual/react-is.production.min2.js +0 -2
  25. package/dist/cjs/_virtual/react-is.production.min2.js.map +1 -1
  26. package/dist/cjs/components/buttons/delete/delete.js +9 -10
  27. package/dist/cjs/components/buttons/delete/delete.js.map +1 -1
  28. package/dist/cjs/components/checkbox/checkbox.js +7 -8
  29. package/dist/cjs/components/checkbox/checkbox.js.map +1 -1
  30. package/dist/cjs/components/drag-list/drag-list.js +3 -3
  31. package/dist/cjs/components/drag-list/drag-list.js.map +1 -1
  32. package/dist/cjs/components/drag-list/draggable/draggable.js +2 -2
  33. package/dist/cjs/components/drag-list/draggable/draggable.js.map +1 -1
  34. package/dist/cjs/components/form/form.js +4 -4
  35. package/dist/cjs/components/form/form.js.map +1 -1
  36. package/dist/cjs/components/input/input.js +5 -6
  37. package/dist/cjs/components/input/input.js.map +1 -1
  38. package/dist/cjs/components/layers/leaflet/hooks/useGetLeafletLayer.js +18 -18
  39. package/dist/cjs/components/layers/leaflet/hooks/useGetLeafletLayer.js.map +1 -1
  40. package/dist/cjs/components/layers/leaflet/leaflet.js +8 -13
  41. package/dist/cjs/components/layers/leaflet/leaflet.js.map +1 -1
  42. package/dist/cjs/components/list/list.js +8 -9
  43. package/dist/cjs/components/list/list.js.map +1 -1
  44. package/dist/cjs/components/no-data/no-data.js +2 -2
  45. package/dist/cjs/components/no-data/no-data.js.map +1 -1
  46. package/dist/cjs/components/paragraph/paragraph.js +2 -2
  47. package/dist/cjs/components/paragraph/paragraph.js.map +1 -1
  48. package/dist/cjs/components/select/select.js +6 -7
  49. package/dist/cjs/components/select/select.js.map +1 -1
  50. package/dist/cjs/configs/global/constants.js +0 -2
  51. package/dist/cjs/configs/global/constants.js.map +1 -1
  52. package/dist/cjs/configs/global/global.js +23 -21
  53. package/dist/cjs/configs/global/global.js.map +1 -1
  54. package/dist/cjs/constants/api.js +0 -2
  55. package/dist/cjs/constants/api.js.map +1 -1
  56. package/dist/cjs/constants/map.js +0 -2
  57. package/dist/cjs/constants/map.js.map +1 -1
  58. package/dist/cjs/index.js +11 -13
  59. package/dist/cjs/index.js.map +1 -1
  60. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +1 -1
  61. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -1
  62. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +1 -1
  63. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -1
  64. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +2 -2
  65. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -1
  66. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  67. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
  68. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +1 -1
  69. package/dist/cjs/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -1
  70. package/dist/cjs/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +2 -8
  71. package/dist/cjs/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +1 -1
  72. package/dist/cjs/node_modules/@dnd-kit/core/dist/core.esm.js +9 -15
  73. package/dist/cjs/node_modules/@dnd-kit/core/dist/core.esm.js.map +1 -1
  74. package/dist/cjs/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +2 -8
  75. package/dist/cjs/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
  76. package/dist/cjs/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -2
  77. package/dist/cjs/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +1 -1
  78. package/dist/cjs/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +3 -3
  79. package/dist/cjs/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js.map +1 -1
  80. package/dist/cjs/node_modules/@emotion/hash/dist/emotion-hash.esm.js +1 -1
  81. package/dist/cjs/node_modules/@emotion/hash/dist/emotion-hash.esm.js.map +1 -1
  82. package/dist/cjs/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +3 -3
  83. package/dist/cjs/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js.map +1 -1
  84. package/dist/cjs/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +1 -1
  85. package/dist/cjs/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js.map +1 -1
  86. package/dist/cjs/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +5 -11
  87. package/dist/cjs/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js.map +1 -1
  88. package/dist/cjs/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +3 -6
  89. package/dist/cjs/node_modules/@emotion/react/dist/emotion-react.browser.esm.js.map +1 -1
  90. package/dist/cjs/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js +3 -12
  91. package/dist/cjs/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js.map +1 -1
  92. package/dist/cjs/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js +1 -5
  93. package/dist/cjs/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js.map +1 -1
  94. package/dist/cjs/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js +6 -12
  95. package/dist/cjs/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js.map +1 -1
  96. package/dist/cjs/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js +2 -2
  97. package/dist/cjs/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js.map +1 -1
  98. package/dist/cjs/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +1 -1
  99. package/dist/cjs/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +1 -1
  100. package/dist/cjs/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js +3 -6
  101. package/dist/cjs/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js.map +1 -1
  102. package/dist/cjs/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js +0 -2
  103. package/dist/cjs/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js.map +1 -1
  104. package/dist/cjs/node_modules/@mui/icons-material/esm/Delete.js +2 -2
  105. package/dist/cjs/node_modules/@mui/icons-material/esm/Delete.js.map +1 -1
  106. package/dist/cjs/node_modules/@mui/material/esm/Autocomplete/Autocomplete.js +165 -167
  107. package/dist/cjs/node_modules/@mui/material/esm/Autocomplete/Autocomplete.js.map +1 -1
  108. package/dist/cjs/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js +3 -4
  109. package/dist/cjs/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js.map +1 -1
  110. package/dist/cjs/node_modules/@mui/material/esm/Backdrop/Backdrop.js +33 -35
  111. package/dist/cjs/node_modules/@mui/material/esm/Backdrop/Backdrop.js.map +1 -1
  112. package/dist/cjs/node_modules/@mui/material/esm/Backdrop/backdropClasses.js +2 -4
  113. package/dist/cjs/node_modules/@mui/material/esm/Backdrop/backdropClasses.js.map +1 -1
  114. package/dist/cjs/node_modules/@mui/material/esm/Box/Box.js +11 -12
  115. package/dist/cjs/node_modules/@mui/material/esm/Box/Box.js.map +1 -1
  116. package/dist/cjs/node_modules/@mui/material/esm/Box/boxClasses.js +2 -3
  117. package/dist/cjs/node_modules/@mui/material/esm/Box/boxClasses.js.map +1 -1
  118. package/dist/cjs/node_modules/@mui/material/esm/Button/Button.js +58 -60
  119. package/dist/cjs/node_modules/@mui/material/esm/Button/Button.js.map +1 -1
  120. package/dist/cjs/node_modules/@mui/material/esm/Button/buttonClasses.js +3 -4
  121. package/dist/cjs/node_modules/@mui/material/esm/Button/buttonClasses.js.map +1 -1
  122. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/ButtonBase.js +58 -60
  123. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/ButtonBase.js.map +1 -1
  124. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/Ripple.js +14 -15
  125. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/Ripple.js.map +1 -1
  126. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js +26 -28
  127. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js.map +1 -1
  128. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js +3 -4
  129. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js.map +1 -1
  130. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js +2 -3
  131. package/dist/cjs/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js.map +1 -1
  132. package/dist/cjs/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupButtonContext.js +4 -6
  133. package/dist/cjs/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupButtonContext.js.map +1 -1
  134. package/dist/cjs/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupContext.js +4 -6
  135. package/dist/cjs/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupContext.js.map +1 -1
  136. package/dist/cjs/node_modules/@mui/material/esm/Checkbox/Checkbox.js +46 -48
  137. package/dist/cjs/node_modules/@mui/material/esm/Checkbox/Checkbox.js.map +1 -1
  138. package/dist/cjs/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js +4 -5
  139. package/dist/cjs/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js.map +1 -1
  140. package/dist/cjs/node_modules/@mui/material/esm/Chip/Chip.js +95 -97
  141. package/dist/cjs/node_modules/@mui/material/esm/Chip/Chip.js.map +1 -1
  142. package/dist/cjs/node_modules/@mui/material/esm/Chip/chipClasses.js +3 -4
  143. package/dist/cjs/node_modules/@mui/material/esm/Chip/chipClasses.js.map +1 -1
  144. package/dist/cjs/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js +61 -36
  145. package/dist/cjs/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js.map +1 -1
  146. package/dist/cjs/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js +2 -4
  147. package/dist/cjs/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js.map +1 -1
  148. package/dist/cjs/node_modules/@mui/material/esm/DefaultPropsProvider/DefaultPropsProvider.js +3 -5
  149. package/dist/cjs/node_modules/@mui/material/esm/DefaultPropsProvider/DefaultPropsProvider.js.map +1 -1
  150. package/dist/cjs/node_modules/@mui/material/esm/Dialog/Dialog.js +71 -73
  151. package/dist/cjs/node_modules/@mui/material/esm/Dialog/Dialog.js.map +1 -1
  152. package/dist/cjs/node_modules/@mui/material/esm/Dialog/DialogContext.js +4 -6
  153. package/dist/cjs/node_modules/@mui/material/esm/Dialog/DialogContext.js.map +1 -1
  154. package/dist/cjs/node_modules/@mui/material/esm/Dialog/dialogClasses.js +3 -4
  155. package/dist/cjs/node_modules/@mui/material/esm/Dialog/dialogClasses.js.map +1 -1
  156. package/dist/cjs/node_modules/@mui/material/esm/DialogActions/DialogActions.js +13 -15
  157. package/dist/cjs/node_modules/@mui/material/esm/DialogActions/DialogActions.js.map +1 -1
  158. package/dist/cjs/node_modules/@mui/material/esm/DialogActions/dialogActionsClasses.js +2 -4
  159. package/dist/cjs/node_modules/@mui/material/esm/DialogActions/dialogActionsClasses.js.map +1 -1
  160. package/dist/cjs/node_modules/@mui/material/esm/DialogContent/DialogContent.js +15 -17
  161. package/dist/cjs/node_modules/@mui/material/esm/DialogContent/DialogContent.js.map +1 -1
  162. package/dist/cjs/node_modules/@mui/material/esm/DialogContent/dialogContentClasses.js +2 -4
  163. package/dist/cjs/node_modules/@mui/material/esm/DialogContent/dialogContentClasses.js.map +1 -1
  164. package/dist/cjs/node_modules/@mui/material/esm/DialogContentText/DialogContentText.js +14 -16
  165. package/dist/cjs/node_modules/@mui/material/esm/DialogContentText/DialogContentText.js.map +1 -1
  166. package/dist/cjs/node_modules/@mui/material/esm/DialogContentText/dialogContentTextClasses.js +2 -4
  167. package/dist/cjs/node_modules/@mui/material/esm/DialogContentText/dialogContentTextClasses.js.map +1 -1
  168. package/dist/cjs/node_modules/@mui/material/esm/DialogTitle/DialogTitle.js +15 -17
  169. package/dist/cjs/node_modules/@mui/material/esm/DialogTitle/DialogTitle.js.map +1 -1
  170. package/dist/cjs/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js +3 -4
  171. package/dist/cjs/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js.map +1 -1
  172. package/dist/cjs/node_modules/@mui/material/esm/Fade/Fade.js +29 -31
  173. package/dist/cjs/node_modules/@mui/material/esm/Fade/Fade.js.map +1 -1
  174. package/dist/cjs/node_modules/@mui/material/esm/FilledInput/FilledInput.js +65 -67
  175. package/dist/cjs/node_modules/@mui/material/esm/FilledInput/FilledInput.js.map +1 -1
  176. package/dist/cjs/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js +5 -6
  177. package/dist/cjs/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js.map +1 -1
  178. package/dist/cjs/node_modules/@mui/material/esm/FormControl/FormControl.js +31 -33
  179. package/dist/cjs/node_modules/@mui/material/esm/FormControl/FormControl.js.map +1 -1
  180. package/dist/cjs/node_modules/@mui/material/esm/FormControl/FormControlContext.js +4 -6
  181. package/dist/cjs/node_modules/@mui/material/esm/FormControl/FormControlContext.js.map +1 -1
  182. package/dist/cjs/node_modules/@mui/material/esm/FormControl/formControlClasses.js +2 -4
  183. package/dist/cjs/node_modules/@mui/material/esm/FormControl/formControlClasses.js.map +1 -1
  184. package/dist/cjs/node_modules/@mui/material/esm/FormControl/formControlState.js +1 -1
  185. package/dist/cjs/node_modules/@mui/material/esm/FormControl/formControlState.js.map +1 -1
  186. package/dist/cjs/node_modules/@mui/material/esm/FormControl/useFormControl.js +5 -6
  187. package/dist/cjs/node_modules/@mui/material/esm/FormControl/useFormControl.js.map +1 -1
  188. package/dist/cjs/node_modules/@mui/material/esm/FormControlLabel/FormControlLabel.js +45 -47
  189. package/dist/cjs/node_modules/@mui/material/esm/FormControlLabel/FormControlLabel.js.map +1 -1
  190. package/dist/cjs/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js +3 -4
  191. package/dist/cjs/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js.map +1 -1
  192. package/dist/cjs/node_modules/@mui/material/esm/FormHelperText/FormHelperText.js +28 -30
  193. package/dist/cjs/node_modules/@mui/material/esm/FormHelperText/FormHelperText.js.map +1 -1
  194. package/dist/cjs/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js +3 -4
  195. package/dist/cjs/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js.map +1 -1
  196. package/dist/cjs/node_modules/@mui/material/esm/FormLabel/FormLabel.js +31 -33
  197. package/dist/cjs/node_modules/@mui/material/esm/FormLabel/FormLabel.js.map +1 -1
  198. package/dist/cjs/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js +3 -4
  199. package/dist/cjs/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js.map +1 -1
  200. package/dist/cjs/node_modules/@mui/material/esm/GlobalStyles/GlobalStyles.js +6 -6
  201. package/dist/cjs/node_modules/@mui/material/esm/GlobalStyles/GlobalStyles.js.map +1 -1
  202. package/dist/cjs/node_modules/@mui/material/esm/Grow/Grow.js +30 -32
  203. package/dist/cjs/node_modules/@mui/material/esm/Grow/Grow.js.map +1 -1
  204. package/dist/cjs/node_modules/@mui/material/esm/IconButton/IconButton.js +35 -37
  205. package/dist/cjs/node_modules/@mui/material/esm/IconButton/IconButton.js.map +1 -1
  206. package/dist/cjs/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js +3 -4
  207. package/dist/cjs/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js.map +1 -1
  208. package/dist/cjs/node_modules/@mui/material/esm/Input/Input.js +59 -61
  209. package/dist/cjs/node_modules/@mui/material/esm/Input/Input.js.map +1 -1
  210. package/dist/cjs/node_modules/@mui/material/esm/Input/inputClasses.js +5 -6
  211. package/dist/cjs/node_modules/@mui/material/esm/Input/inputClasses.js.map +1 -1
  212. package/dist/cjs/node_modules/@mui/material/esm/InputBase/InputBase.js +81 -83
  213. package/dist/cjs/node_modules/@mui/material/esm/InputBase/InputBase.js.map +1 -1
  214. package/dist/cjs/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js +3 -4
  215. package/dist/cjs/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js.map +1 -1
  216. package/dist/cjs/node_modules/@mui/material/esm/InputBase/utils.js +0 -2
  217. package/dist/cjs/node_modules/@mui/material/esm/InputBase/utils.js.map +1 -1
  218. package/dist/cjs/node_modules/@mui/material/esm/InputLabel/InputLabel.js +30 -32
  219. package/dist/cjs/node_modules/@mui/material/esm/InputLabel/InputLabel.js.map +1 -1
  220. package/dist/cjs/node_modules/@mui/material/esm/InputLabel/inputLabelClasses.js +2 -4
  221. package/dist/cjs/node_modules/@mui/material/esm/InputLabel/inputLabelClasses.js.map +1 -1
  222. package/dist/cjs/node_modules/@mui/material/esm/List/List.js +17 -19
  223. package/dist/cjs/node_modules/@mui/material/esm/List/List.js.map +1 -1
  224. package/dist/cjs/node_modules/@mui/material/esm/List/ListContext.js +4 -6
  225. package/dist/cjs/node_modules/@mui/material/esm/List/ListContext.js.map +1 -1
  226. package/dist/cjs/node_modules/@mui/material/esm/List/listClasses.js +2 -4
  227. package/dist/cjs/node_modules/@mui/material/esm/List/listClasses.js.map +1 -1
  228. package/dist/cjs/node_modules/@mui/material/esm/ListItem/ListItem.js +46 -48
  229. package/dist/cjs/node_modules/@mui/material/esm/ListItem/ListItem.js.map +1 -1
  230. package/dist/cjs/node_modules/@mui/material/esm/ListItem/listItemClasses.js +2 -4
  231. package/dist/cjs/node_modules/@mui/material/esm/ListItem/listItemClasses.js.map +1 -1
  232. package/dist/cjs/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js +2 -3
  233. package/dist/cjs/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js.map +1 -1
  234. package/dist/cjs/node_modules/@mui/material/esm/ListItemSecondaryAction/ListItemSecondaryAction.js +13 -15
  235. package/dist/cjs/node_modules/@mui/material/esm/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -1
  236. package/dist/cjs/node_modules/@mui/material/esm/ListItemSecondaryAction/listItemSecondaryActionClasses.js +2 -4
  237. package/dist/cjs/node_modules/@mui/material/esm/ListItemSecondaryAction/listItemSecondaryActionClasses.js.map +1 -1
  238. package/dist/cjs/node_modules/@mui/material/esm/ListSubheader/ListSubheader.js +21 -23
  239. package/dist/cjs/node_modules/@mui/material/esm/ListSubheader/ListSubheader.js.map +1 -1
  240. package/dist/cjs/node_modules/@mui/material/esm/ListSubheader/listSubheaderClasses.js +2 -4
  241. package/dist/cjs/node_modules/@mui/material/esm/ListSubheader/listSubheaderClasses.js.map +1 -1
  242. package/dist/cjs/node_modules/@mui/material/esm/Menu/Menu.js +47 -49
  243. package/dist/cjs/node_modules/@mui/material/esm/Menu/Menu.js.map +1 -1
  244. package/dist/cjs/node_modules/@mui/material/esm/Menu/menuClasses.js +2 -4
  245. package/dist/cjs/node_modules/@mui/material/esm/Menu/menuClasses.js.map +1 -1
  246. package/dist/cjs/node_modules/@mui/material/esm/MenuList/MenuList.js +21 -23
  247. package/dist/cjs/node_modules/@mui/material/esm/MenuList/MenuList.js.map +1 -1
  248. package/dist/cjs/node_modules/@mui/material/esm/Modal/Modal.js +50 -52
  249. package/dist/cjs/node_modules/@mui/material/esm/Modal/Modal.js.map +1 -1
  250. package/dist/cjs/node_modules/@mui/material/esm/Modal/ModalManager.js +7 -9
  251. package/dist/cjs/node_modules/@mui/material/esm/Modal/ModalManager.js.map +1 -1
  252. package/dist/cjs/node_modules/@mui/material/esm/Modal/modalClasses.js +2 -4
  253. package/dist/cjs/node_modules/@mui/material/esm/Modal/modalClasses.js.map +1 -1
  254. package/dist/cjs/node_modules/@mui/material/esm/Modal/useModal.js +12 -13
  255. package/dist/cjs/node_modules/@mui/material/esm/Modal/useModal.js.map +1 -1
  256. package/dist/cjs/node_modules/@mui/material/esm/NativeSelect/NativeSelectInput.js +30 -32
  257. package/dist/cjs/node_modules/@mui/material/esm/NativeSelect/NativeSelectInput.js.map +1 -1
  258. package/dist/cjs/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js +3 -4
  259. package/dist/cjs/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js.map +1 -1
  260. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/NotchedOutline.js +13 -13
  261. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/NotchedOutline.js.map +1 -1
  262. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/OutlinedInput.js +67 -69
  263. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/OutlinedInput.js.map +1 -1
  264. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js +5 -6
  265. package/dist/cjs/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js.map +1 -1
  266. package/dist/cjs/node_modules/@mui/material/esm/Paper/Paper.js +20 -22
  267. package/dist/cjs/node_modules/@mui/material/esm/Paper/Paper.js.map +1 -1
  268. package/dist/cjs/node_modules/@mui/material/esm/Paper/paperClasses.js +2 -4
  269. package/dist/cjs/node_modules/@mui/material/esm/Paper/paperClasses.js.map +1 -1
  270. package/dist/cjs/node_modules/@mui/material/esm/Popover/Popover.js +71 -73
  271. package/dist/cjs/node_modules/@mui/material/esm/Popover/Popover.js.map +1 -1
  272. package/dist/cjs/node_modules/@mui/material/esm/Popover/popoverClasses.js +2 -4
  273. package/dist/cjs/node_modules/@mui/material/esm/Popover/popoverClasses.js.map +1 -1
  274. package/dist/cjs/node_modules/@mui/material/esm/Popper/BasePopper.js +45 -47
  275. package/dist/cjs/node_modules/@mui/material/esm/Popper/BasePopper.js.map +1 -1
  276. package/dist/cjs/node_modules/@mui/material/esm/Popper/Popper.js +42 -44
  277. package/dist/cjs/node_modules/@mui/material/esm/Popper/Popper.js.map +1 -1
  278. package/dist/cjs/node_modules/@mui/material/esm/Popper/popperClasses.js +2 -4
  279. package/dist/cjs/node_modules/@mui/material/esm/Popper/popperClasses.js.map +1 -1
  280. package/dist/cjs/node_modules/@mui/material/esm/Portal/Portal.js +15 -17
  281. package/dist/cjs/node_modules/@mui/material/esm/Portal/Portal.js.map +1 -1
  282. package/dist/cjs/node_modules/@mui/material/esm/Select/Select.js +46 -48
  283. package/dist/cjs/node_modules/@mui/material/esm/Select/Select.js.map +1 -1
  284. package/dist/cjs/node_modules/@mui/material/esm/Select/SelectInput.js +62 -64
  285. package/dist/cjs/node_modules/@mui/material/esm/Select/SelectInput.js.map +1 -1
  286. package/dist/cjs/node_modules/@mui/material/esm/Select/selectClasses.js +3 -3
  287. package/dist/cjs/node_modules/@mui/material/esm/Select/selectClasses.js.map +1 -1
  288. package/dist/cjs/node_modules/@mui/material/esm/Slide/Slide.js +35 -37
  289. package/dist/cjs/node_modules/@mui/material/esm/Slide/Slide.js.map +1 -1
  290. package/dist/cjs/node_modules/@mui/material/esm/SvgIcon/SvgIcon.js +24 -26
  291. package/dist/cjs/node_modules/@mui/material/esm/SvgIcon/SvgIcon.js.map +1 -1
  292. package/dist/cjs/node_modules/@mui/material/esm/SvgIcon/svgIconClasses.js +2 -4
  293. package/dist/cjs/node_modules/@mui/material/esm/SvgIcon/svgIconClasses.js.map +1 -1
  294. package/dist/cjs/node_modules/@mui/material/esm/TextField/TextField.js +75 -77
  295. package/dist/cjs/node_modules/@mui/material/esm/TextField/TextField.js.map +1 -1
  296. package/dist/cjs/node_modules/@mui/material/esm/TextField/textFieldClasses.js +2 -4
  297. package/dist/cjs/node_modules/@mui/material/esm/TextField/textFieldClasses.js.map +1 -1
  298. package/dist/cjs/node_modules/@mui/material/esm/TextareaAutosize/TextareaAutosize.js +19 -21
  299. package/dist/cjs/node_modules/@mui/material/esm/TextareaAutosize/TextareaAutosize.js.map +1 -1
  300. package/dist/cjs/node_modules/@mui/material/esm/Typography/Typography.js +29 -31
  301. package/dist/cjs/node_modules/@mui/material/esm/Typography/Typography.js.map +1 -1
  302. package/dist/cjs/node_modules/@mui/material/esm/Typography/typographyClasses.js +2 -4
  303. package/dist/cjs/node_modules/@mui/material/esm/Typography/typographyClasses.js.map +1 -1
  304. package/dist/cjs/node_modules/@mui/material/esm/Unstable_TrapFocus/FocusTrap.js +16 -17
  305. package/dist/cjs/node_modules/@mui/material/esm/Unstable_TrapFocus/FocusTrap.js.map +1 -1
  306. package/dist/cjs/node_modules/@mui/material/esm/colors/blue.js +2 -13
  307. package/dist/cjs/node_modules/@mui/material/esm/colors/blue.js.map +1 -1
  308. package/dist/cjs/node_modules/@mui/material/esm/colors/common.js +1 -2
  309. package/dist/cjs/node_modules/@mui/material/esm/colors/common.js.map +1 -1
  310. package/dist/cjs/node_modules/@mui/material/esm/colors/green.js +2 -12
  311. package/dist/cjs/node_modules/@mui/material/esm/colors/green.js.map +1 -1
  312. package/dist/cjs/node_modules/@mui/material/esm/colors/grey.js +1 -2
  313. package/dist/cjs/node_modules/@mui/material/esm/colors/grey.js.map +1 -1
  314. package/dist/cjs/node_modules/@mui/material/esm/colors/lightBlue.js +2 -13
  315. package/dist/cjs/node_modules/@mui/material/esm/colors/lightBlue.js.map +1 -1
  316. package/dist/cjs/node_modules/@mui/material/esm/colors/orange.js +2 -13
  317. package/dist/cjs/node_modules/@mui/material/esm/colors/orange.js.map +1 -1
  318. package/dist/cjs/node_modules/@mui/material/esm/colors/purple.js +2 -12
  319. package/dist/cjs/node_modules/@mui/material/esm/colors/purple.js.map +1 -1
  320. package/dist/cjs/node_modules/@mui/material/esm/colors/red.js +2 -13
  321. package/dist/cjs/node_modules/@mui/material/esm/colors/red.js.map +1 -1
  322. package/dist/cjs/node_modules/@mui/material/esm/internal/SwitchBase.js +46 -48
  323. package/dist/cjs/node_modules/@mui/material/esm/internal/SwitchBase.js.map +1 -1
  324. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/ArrowDropDown.js +2 -2
  325. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/ArrowDropDown.js.map +1 -1
  326. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/Cancel.js +2 -2
  327. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/Cancel.js.map +1 -1
  328. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/CheckBox.js +2 -2
  329. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/CheckBox.js.map +1 -1
  330. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/CheckBoxOutlineBlank.js +2 -2
  331. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/CheckBoxOutlineBlank.js.map +1 -1
  332. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/Close.js +2 -2
  333. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/Close.js.map +1 -1
  334. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/IndeterminateCheckBox.js +2 -2
  335. package/dist/cjs/node_modules/@mui/material/esm/internal/svg-icons/IndeterminateCheckBox.js.map +1 -1
  336. package/dist/cjs/node_modules/@mui/material/esm/internal/switchBaseClasses.js +2 -4
  337. package/dist/cjs/node_modules/@mui/material/esm/internal/switchBaseClasses.js.map +1 -1
  338. package/dist/cjs/node_modules/@mui/material/esm/styles/createColorScheme.js +5 -5
  339. package/dist/cjs/node_modules/@mui/material/esm/styles/createColorScheme.js.map +1 -1
  340. package/dist/cjs/node_modules/@mui/material/esm/styles/createGetSelector.js +2 -2
  341. package/dist/cjs/node_modules/@mui/material/esm/styles/createGetSelector.js.map +1 -1
  342. package/dist/cjs/node_modules/@mui/material/esm/styles/createMixins.js +1 -1
  343. package/dist/cjs/node_modules/@mui/material/esm/styles/createMixins.js.map +1 -1
  344. package/dist/cjs/node_modules/@mui/material/esm/styles/createPalette.js +45 -45
  345. package/dist/cjs/node_modules/@mui/material/esm/styles/createPalette.js.map +1 -1
  346. package/dist/cjs/node_modules/@mui/material/esm/styles/createTheme.js +7 -7
  347. package/dist/cjs/node_modules/@mui/material/esm/styles/createTheme.js.map +1 -1
  348. package/dist/cjs/node_modules/@mui/material/esm/styles/createThemeNoVars.js +16 -16
  349. package/dist/cjs/node_modules/@mui/material/esm/styles/createThemeNoVars.js.map +1 -1
  350. package/dist/cjs/node_modules/@mui/material/esm/styles/createThemeWithVars.js +14 -14
  351. package/dist/cjs/node_modules/@mui/material/esm/styles/createThemeWithVars.js.map +1 -1
  352. package/dist/cjs/node_modules/@mui/material/esm/styles/createTransitions.js +1 -1
  353. package/dist/cjs/node_modules/@mui/material/esm/styles/createTransitions.js.map +1 -1
  354. package/dist/cjs/node_modules/@mui/material/esm/styles/createTypography.js +2 -2
  355. package/dist/cjs/node_modules/@mui/material/esm/styles/createTypography.js.map +1 -1
  356. package/dist/cjs/node_modules/@mui/material/esm/styles/defaultTheme.js +2 -3
  357. package/dist/cjs/node_modules/@mui/material/esm/styles/defaultTheme.js.map +1 -1
  358. package/dist/cjs/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js +1 -2
  359. package/dist/cjs/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js.map +1 -1
  360. package/dist/cjs/node_modules/@mui/material/esm/styles/getOverlayAlpha.js +1 -1
  361. package/dist/cjs/node_modules/@mui/material/esm/styles/getOverlayAlpha.js.map +1 -1
  362. package/dist/cjs/node_modules/@mui/material/esm/styles/identifier.js +1 -1
  363. package/dist/cjs/node_modules/@mui/material/esm/styles/identifier.js.map +1 -1
  364. package/dist/cjs/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js +2 -3
  365. package/dist/cjs/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js.map +1 -1
  366. package/dist/cjs/node_modules/@mui/material/esm/styles/shadows.js +1 -2
  367. package/dist/cjs/node_modules/@mui/material/esm/styles/shadows.js.map +1 -1
  368. package/dist/cjs/node_modules/@mui/material/esm/styles/shouldSkipGeneratingVar.js +1 -1
  369. package/dist/cjs/node_modules/@mui/material/esm/styles/shouldSkipGeneratingVar.js.map +1 -1
  370. package/dist/cjs/node_modules/@mui/material/esm/styles/slotShouldForwardProp.js +1 -1
  371. package/dist/cjs/node_modules/@mui/material/esm/styles/slotShouldForwardProp.js.map +1 -1
  372. package/dist/cjs/node_modules/@mui/material/esm/styles/stringifyTheme.js +0 -2
  373. package/dist/cjs/node_modules/@mui/material/esm/styles/stringifyTheme.js.map +1 -1
  374. package/dist/cjs/node_modules/@mui/material/esm/styles/styled.js +6 -7
  375. package/dist/cjs/node_modules/@mui/material/esm/styles/styled.js.map +1 -1
  376. package/dist/cjs/node_modules/@mui/material/esm/styles/useTheme.js +6 -7
  377. package/dist/cjs/node_modules/@mui/material/esm/styles/useTheme.js.map +1 -1
  378. package/dist/cjs/node_modules/@mui/material/esm/styles/zIndex.js +1 -2
  379. package/dist/cjs/node_modules/@mui/material/esm/styles/zIndex.js.map +1 -1
  380. package/dist/cjs/node_modules/@mui/material/esm/transitions/utils.js +0 -2
  381. package/dist/cjs/node_modules/@mui/material/esm/transitions/utils.js.map +1 -1
  382. package/dist/cjs/node_modules/@mui/material/esm/useAutocomplete/useAutocomplete.js +16 -17
  383. package/dist/cjs/node_modules/@mui/material/esm/useAutocomplete/useAutocomplete.js.map +1 -1
  384. package/dist/cjs/node_modules/@mui/material/esm/useLazyRipple/useLazyRipple.js +5 -6
  385. package/dist/cjs/node_modules/@mui/material/esm/useLazyRipple/useLazyRipple.js.map +1 -1
  386. package/dist/cjs/node_modules/@mui/material/esm/utils/capitalize.js +1 -1
  387. package/dist/cjs/node_modules/@mui/material/esm/utils/createSimplePaletteValueFilter.js +1 -1
  388. package/dist/cjs/node_modules/@mui/material/esm/utils/createSimplePaletteValueFilter.js.map +1 -1
  389. package/dist/cjs/node_modules/@mui/material/esm/utils/createSvgIcon.js +6 -7
  390. package/dist/cjs/node_modules/@mui/material/esm/utils/createSvgIcon.js.map +1 -1
  391. package/dist/cjs/node_modules/@mui/material/esm/utils/debounce.js +1 -1
  392. package/dist/cjs/node_modules/@mui/material/esm/utils/getScrollbarSize.js +1 -1
  393. package/dist/cjs/node_modules/@mui/material/esm/utils/isMuiElement.js +1 -1
  394. package/dist/cjs/node_modules/@mui/material/esm/utils/memoTheme.js +3 -4
  395. package/dist/cjs/node_modules/@mui/material/esm/utils/memoTheme.js.map +1 -1
  396. package/dist/cjs/node_modules/@mui/material/esm/utils/mergeSlotProps.js +1 -1
  397. package/dist/cjs/node_modules/@mui/material/esm/utils/mergeSlotProps.js.map +1 -1
  398. package/dist/cjs/node_modules/@mui/material/esm/utils/ownerDocument.js +1 -1
  399. package/dist/cjs/node_modules/@mui/material/esm/utils/ownerWindow.js +1 -1
  400. package/dist/cjs/node_modules/@mui/material/esm/utils/unsupportedProp.js +1 -1
  401. package/dist/cjs/node_modules/@mui/material/esm/utils/useControlled.js +1 -1
  402. package/dist/cjs/node_modules/@mui/material/esm/utils/useEnhancedEffect.js +1 -1
  403. package/dist/cjs/node_modules/@mui/material/esm/utils/useEventCallback.js +1 -1
  404. package/dist/cjs/node_modules/@mui/material/esm/utils/useForkRef.js +1 -1
  405. package/dist/cjs/node_modules/@mui/material/esm/utils/useId.js +1 -1
  406. package/dist/cjs/node_modules/@mui/material/esm/utils/useSlot.js +5 -5
  407. package/dist/cjs/node_modules/@mui/material/esm/utils/useSlot.js.map +1 -1
  408. package/dist/cjs/node_modules/@mui/material/esm/zero-styled/index.js +2 -4
  409. package/dist/cjs/node_modules/@mui/material/esm/zero-styled/index.js.map +1 -1
  410. package/dist/cjs/node_modules/@mui/styled-engine/esm/GlobalStyles/GlobalStyles.js +4 -4
  411. package/dist/cjs/node_modules/@mui/styled-engine/esm/GlobalStyles/GlobalStyles.js.map +1 -1
  412. package/dist/cjs/node_modules/@mui/styled-engine/esm/index.js +3 -3
  413. package/dist/cjs/node_modules/@mui/styled-engine/esm/index.js.map +1 -1
  414. package/dist/cjs/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js +8 -11
  415. package/dist/cjs/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js.map +1 -1
  416. package/dist/cjs/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js +9 -9
  417. package/dist/cjs/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js.map +1 -1
  418. package/dist/cjs/node_modules/@mui/system/esm/RtlProvider/index.js +6 -9
  419. package/dist/cjs/node_modules/@mui/system/esm/RtlProvider/index.js.map +1 -1
  420. package/dist/cjs/node_modules/@mui/system/esm/borders/borders.js +3 -5
  421. package/dist/cjs/node_modules/@mui/system/esm/borders/borders.js.map +1 -1
  422. package/dist/cjs/node_modules/@mui/system/esm/breakpoints/breakpoints.js +0 -2
  423. package/dist/cjs/node_modules/@mui/system/esm/breakpoints/breakpoints.js.map +1 -1
  424. package/dist/cjs/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js +4 -9
  425. package/dist/cjs/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js.map +1 -1
  426. package/dist/cjs/node_modules/@mui/system/esm/compose/compose.js +2 -2
  427. package/dist/cjs/node_modules/@mui/system/esm/compose/compose.js.map +1 -1
  428. package/dist/cjs/node_modules/@mui/system/esm/createBox/createBox.js +8 -9
  429. package/dist/cjs/node_modules/@mui/system/esm/createBox/createBox.js.map +1 -1
  430. package/dist/cjs/node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js +2 -1
  431. package/dist/cjs/node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js.map +1 -1
  432. package/dist/cjs/node_modules/@mui/system/esm/createStyled/createStyled.js +8 -8
  433. package/dist/cjs/node_modules/@mui/system/esm/createStyled/createStyled.js.map +1 -1
  434. package/dist/cjs/node_modules/@mui/system/esm/createTheme/applyStyles.js +1 -1
  435. package/dist/cjs/node_modules/@mui/system/esm/createTheme/applyStyles.js.map +1 -1
  436. package/dist/cjs/node_modules/@mui/system/esm/createTheme/createSpacing.js +1 -1
  437. package/dist/cjs/node_modules/@mui/system/esm/createTheme/createSpacing.js.map +1 -1
  438. package/dist/cjs/node_modules/@mui/system/esm/createTheme/createTheme.js +10 -10
  439. package/dist/cjs/node_modules/@mui/system/esm/createTheme/createTheme.js.map +1 -1
  440. package/dist/cjs/node_modules/@mui/system/esm/createTheme/shape.js +1 -2
  441. package/dist/cjs/node_modules/@mui/system/esm/createTheme/shape.js.map +1 -1
  442. package/dist/cjs/node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js +3 -3
  443. package/dist/cjs/node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js.map +1 -1
  444. package/dist/cjs/node_modules/@mui/system/esm/cssGrid/cssGrid.js +13 -15
  445. package/dist/cjs/node_modules/@mui/system/esm/cssGrid/cssGrid.js.map +1 -1
  446. package/dist/cjs/node_modules/@mui/system/esm/cssVars/createGetCssVar.js +1 -1
  447. package/dist/cjs/node_modules/@mui/system/esm/cssVars/createGetCssVar.js.map +1 -1
  448. package/dist/cjs/node_modules/@mui/system/esm/cssVars/cssVarsParser.js +1 -1
  449. package/dist/cjs/node_modules/@mui/system/esm/cssVars/cssVarsParser.js.map +1 -1
  450. package/dist/cjs/node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js +0 -2
  451. package/dist/cjs/node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js.map +1 -1
  452. package/dist/cjs/node_modules/@mui/system/esm/cssVars/prepareCssVars.js +7 -7
  453. package/dist/cjs/node_modules/@mui/system/esm/cssVars/prepareCssVars.js.map +1 -1
  454. package/dist/cjs/node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js +1 -1
  455. package/dist/cjs/node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js.map +1 -1
  456. package/dist/cjs/node_modules/@mui/system/esm/memoTheme.js +2 -2
  457. package/dist/cjs/node_modules/@mui/system/esm/memoTheme.js.map +1 -1
  458. package/dist/cjs/node_modules/@mui/system/esm/memoize/memoize.js +1 -1
  459. package/dist/cjs/node_modules/@mui/system/esm/memoize/memoize.js.map +1 -1
  460. package/dist/cjs/node_modules/@mui/system/esm/merge/merge.js +2 -2
  461. package/dist/cjs/node_modules/@mui/system/esm/merge/merge.js.map +1 -1
  462. package/dist/cjs/node_modules/@mui/system/esm/palette/palette.js +4 -6
  463. package/dist/cjs/node_modules/@mui/system/esm/palette/palette.js.map +1 -1
  464. package/dist/cjs/node_modules/@mui/system/esm/preprocessStyles.js +1 -1
  465. package/dist/cjs/node_modules/@mui/system/esm/preprocessStyles.js.map +1 -1
  466. package/dist/cjs/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js +3 -4
  467. package/dist/cjs/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js.map +1 -1
  468. package/dist/cjs/node_modules/@mui/system/esm/sizing/sizing.js +9 -11
  469. package/dist/cjs/node_modules/@mui/system/esm/sizing/sizing.js.map +1 -1
  470. package/dist/cjs/node_modules/@mui/system/esm/spacing/spacing.js +6 -8
  471. package/dist/cjs/node_modules/@mui/system/esm/spacing/spacing.js.map +1 -1
  472. package/dist/cjs/node_modules/@mui/system/esm/style/style.js +3 -3
  473. package/dist/cjs/node_modules/@mui/system/esm/style/style.js.map +1 -1
  474. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +5 -6
  475. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js.map +1 -1
  476. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js +2 -2
  477. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js.map +1 -1
  478. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +6 -7
  479. package/dist/cjs/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js.map +1 -1
  480. package/dist/cjs/node_modules/@mui/system/esm/useTheme/useTheme.js +3 -3
  481. package/dist/cjs/node_modules/@mui/system/esm/useTheme/useTheme.js.map +1 -1
  482. package/dist/cjs/node_modules/@mui/system/esm/useThemeWithoutDefault/useThemeWithoutDefault.js +4 -5
  483. package/dist/cjs/node_modules/@mui/system/esm/useThemeWithoutDefault/useThemeWithoutDefault.js.map +1 -1
  484. package/dist/cjs/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js +1 -2
  485. package/dist/cjs/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js.map +1 -1
  486. package/dist/cjs/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js +1 -1
  487. package/dist/cjs/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js.map +1 -1
  488. package/dist/cjs/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js +2 -2
  489. package/dist/cjs/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js.map +1 -1
  490. package/dist/cjs/node_modules/@mui/utils/esm/capitalize/capitalize.js +2 -2
  491. package/dist/cjs/node_modules/@mui/utils/esm/capitalize/capitalize.js.map +1 -1
  492. package/dist/cjs/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js +1 -1
  493. package/dist/cjs/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js.map +1 -1
  494. package/dist/cjs/node_modules/@mui/utils/esm/clamp/clamp.js +1 -1
  495. package/dist/cjs/node_modules/@mui/utils/esm/clamp/clamp.js.map +1 -1
  496. package/dist/cjs/node_modules/@mui/utils/esm/composeClasses/composeClasses.js +1 -1
  497. package/dist/cjs/node_modules/@mui/utils/esm/composeClasses/composeClasses.js.map +1 -1
  498. package/dist/cjs/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js +1 -1
  499. package/dist/cjs/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js.map +1 -1
  500. package/dist/cjs/node_modules/@mui/utils/esm/debounce/debounce.js +1 -1
  501. package/dist/cjs/node_modules/@mui/utils/esm/debounce/debounce.js.map +1 -1
  502. package/dist/cjs/node_modules/@mui/utils/esm/deepmerge/deepmerge.js +5 -6
  503. package/dist/cjs/node_modules/@mui/utils/esm/deepmerge/deepmerge.js.map +1 -1
  504. package/dist/cjs/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js +4 -5
  505. package/dist/cjs/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js.map +1 -1
  506. package/dist/cjs/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js +3 -3
  507. package/dist/cjs/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js.map +1 -1
  508. package/dist/cjs/node_modules/@mui/utils/esm/exactProp/exactProp.js +1 -1
  509. package/dist/cjs/node_modules/@mui/utils/esm/exactProp/exactProp.js.map +1 -1
  510. package/dist/cjs/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js +1 -1
  511. package/dist/cjs/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js.map +1 -1
  512. package/dist/cjs/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js +1 -1
  513. package/dist/cjs/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js.map +1 -1
  514. package/dist/cjs/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js +2 -2
  515. package/dist/cjs/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js.map +1 -1
  516. package/dist/cjs/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js +2 -2
  517. package/dist/cjs/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js.map +1 -1
  518. package/dist/cjs/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js +2 -2
  519. package/dist/cjs/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js.map +1 -1
  520. package/dist/cjs/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js +4 -5
  521. package/dist/cjs/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js.map +1 -1
  522. package/dist/cjs/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js +1 -1
  523. package/dist/cjs/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js.map +1 -1
  524. package/dist/cjs/node_modules/@mui/utils/esm/integerPropType/integerPropType.js +1 -2
  525. package/dist/cjs/node_modules/@mui/utils/esm/integerPropType/integerPropType.js.map +1 -1
  526. package/dist/cjs/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js +2 -2
  527. package/dist/cjs/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js.map +1 -1
  528. package/dist/cjs/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js +1 -1
  529. package/dist/cjs/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js.map +1 -1
  530. package/dist/cjs/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js +5 -6
  531. package/dist/cjs/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js.map +1 -1
  532. package/dist/cjs/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js +4 -4
  533. package/dist/cjs/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js.map +1 -1
  534. package/dist/cjs/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js +1 -1
  535. package/dist/cjs/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js.map +1 -1
  536. package/dist/cjs/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js +1 -1
  537. package/dist/cjs/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js.map +1 -1
  538. package/dist/cjs/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js +2 -2
  539. package/dist/cjs/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js.map +1 -1
  540. package/dist/cjs/node_modules/@mui/utils/esm/refType/refType.js +3 -4
  541. package/dist/cjs/node_modules/@mui/utils/esm/refType/refType.js.map +1 -1
  542. package/dist/cjs/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js +1 -1
  543. package/dist/cjs/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js.map +1 -1
  544. package/dist/cjs/node_modules/@mui/utils/esm/resolveProps/resolveProps.js +1 -1
  545. package/dist/cjs/node_modules/@mui/utils/esm/resolveProps/resolveProps.js.map +1 -1
  546. package/dist/cjs/node_modules/@mui/utils/esm/setRef/setRef.js +1 -1
  547. package/dist/cjs/node_modules/@mui/utils/esm/setRef/setRef.js.map +1 -1
  548. package/dist/cjs/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js +1 -1
  549. package/dist/cjs/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js.map +1 -1
  550. package/dist/cjs/node_modules/@mui/utils/esm/useControlled/useControlled.js +6 -9
  551. package/dist/cjs/node_modules/@mui/utils/esm/useControlled/useControlled.js.map +1 -1
  552. package/dist/cjs/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +4 -6
  553. package/dist/cjs/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js.map +1 -1
  554. package/dist/cjs/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js +5 -6
  555. package/dist/cjs/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js.map +1 -1
  556. package/dist/cjs/node_modules/@mui/utils/esm/useForkRef/useForkRef.js +4 -5
  557. package/dist/cjs/node_modules/@mui/utils/esm/useForkRef/useForkRef.js.map +1 -1
  558. package/dist/cjs/node_modules/@mui/utils/esm/useId/useId.js +4 -5
  559. package/dist/cjs/node_modules/@mui/utils/esm/useId/useId.js.map +1 -1
  560. package/dist/cjs/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js +4 -5
  561. package/dist/cjs/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js.map +1 -1
  562. package/dist/cjs/node_modules/@mui/utils/esm/useOnMount/useOnMount.js +4 -5
  563. package/dist/cjs/node_modules/@mui/utils/esm/useOnMount/useOnMount.js.map +1 -1
  564. package/dist/cjs/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js +6 -8
  565. package/dist/cjs/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js.map +1 -1
  566. package/dist/cjs/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js +5 -5
  567. package/dist/cjs/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js.map +1 -1
  568. package/dist/cjs/node_modules/@mui/utils/esm/useTimeout/useTimeout.js +3 -3
  569. package/dist/cjs/node_modules/@mui/utils/esm/useTimeout/useTimeout.js.map +1 -1
  570. package/dist/cjs/node_modules/@popperjs/core/lib/createPopper.js +6 -8
  571. package/dist/cjs/node_modules/@popperjs/core/lib/createPopper.js.map +1 -1
  572. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/contains.js +1 -1
  573. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/contains.js.map +1 -1
  574. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +3 -3
  575. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js.map +1 -1
  576. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +7 -7
  577. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js.map +1 -1
  578. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +8 -8
  579. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js.map +1 -1
  580. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +2 -2
  581. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js.map +1 -1
  582. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +1 -1
  583. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js.map +1 -1
  584. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +5 -5
  585. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js.map +1 -1
  586. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +1 -1
  587. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js.map +1 -1
  588. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +2 -2
  589. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js.map +1 -1
  590. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +1 -1
  591. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js.map +1 -1
  592. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +4 -4
  593. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js.map +1 -1
  594. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +11 -11
  595. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js.map +1 -1
  596. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +3 -3
  597. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js.map +1 -1
  598. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +4 -4
  599. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js.map +1 -1
  600. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +5 -5
  601. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js.map +1 -1
  602. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +1 -1
  603. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindow.js.map +1 -1
  604. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +2 -2
  605. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js.map +1 -1
  606. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +2 -2
  607. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js.map +1 -1
  608. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +3 -5
  609. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js.map +1 -1
  610. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +2 -2
  611. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js.map +1 -1
  612. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +2 -2
  613. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js.map +1 -1
  614. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +2 -2
  615. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js.map +1 -1
  616. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +5 -5
  617. package/dist/cjs/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js.map +1 -1
  618. package/dist/cjs/node_modules/@popperjs/core/lib/enums.js +0 -2
  619. package/dist/cjs/node_modules/@popperjs/core/lib/enums.js.map +1 -1
  620. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +3 -3
  621. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/applyStyles.js.map +1 -1
  622. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/arrow.js +7 -7
  623. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/arrow.js.map +1 -1
  624. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +8 -8
  625. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/computeStyles.js.map +1 -1
  626. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +2 -2
  627. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/eventListeners.js.map +1 -1
  628. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/flip.js +12 -12
  629. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/flip.js.map +1 -1
  630. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/hide.js +3 -3
  631. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/hide.js.map +1 -1
  632. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/offset.js +2 -2
  633. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/offset.js.map +1 -1
  634. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +2 -3
  635. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js.map +1 -1
  636. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +9 -9
  637. package/dist/cjs/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js.map +1 -1
  638. package/dist/cjs/node_modules/@popperjs/core/lib/popper.js +10 -12
  639. package/dist/cjs/node_modules/@popperjs/core/lib/popper.js.map +1 -1
  640. package/dist/cjs/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +5 -5
  641. package/dist/cjs/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js.map +1 -1
  642. package/dist/cjs/node_modules/@popperjs/core/lib/utils/computeOffsets.js +4 -4
  643. package/dist/cjs/node_modules/@popperjs/core/lib/utils/computeOffsets.js.map +1 -1
  644. package/dist/cjs/node_modules/@popperjs/core/lib/utils/debounce.js +1 -1
  645. package/dist/cjs/node_modules/@popperjs/core/lib/utils/debounce.js.map +1 -1
  646. package/dist/cjs/node_modules/@popperjs/core/lib/utils/detectOverflow.js +6 -7
  647. package/dist/cjs/node_modules/@popperjs/core/lib/utils/detectOverflow.js.map +1 -1
  648. package/dist/cjs/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +1 -1
  649. package/dist/cjs/node_modules/@popperjs/core/lib/utils/expandToHashMap.js.map +1 -1
  650. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getAltAxis.js +1 -1
  651. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getAltAxis.js.map +1 -1
  652. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +1 -1
  653. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getBasePlacement.js.map +1 -1
  654. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +1 -1
  655. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js.map +1 -1
  656. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +1 -1
  657. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js.map +1 -1
  658. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +1 -1
  659. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js.map +1 -1
  660. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +1 -1
  661. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js.map +1 -1
  662. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getVariation.js +1 -1
  663. package/dist/cjs/node_modules/@popperjs/core/lib/utils/getVariation.js.map +1 -1
  664. package/dist/cjs/node_modules/@popperjs/core/lib/utils/math.js +0 -2
  665. package/dist/cjs/node_modules/@popperjs/core/lib/utils/math.js.map +1 -1
  666. package/dist/cjs/node_modules/@popperjs/core/lib/utils/mergeByName.js +1 -1
  667. package/dist/cjs/node_modules/@popperjs/core/lib/utils/mergeByName.js.map +1 -1
  668. package/dist/cjs/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +2 -2
  669. package/dist/cjs/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js.map +1 -1
  670. package/dist/cjs/node_modules/@popperjs/core/lib/utils/orderModifiers.js +1 -1
  671. package/dist/cjs/node_modules/@popperjs/core/lib/utils/orderModifiers.js.map +1 -1
  672. package/dist/cjs/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +1 -1
  673. package/dist/cjs/node_modules/@popperjs/core/lib/utils/rectToClientRect.js.map +1 -1
  674. package/dist/cjs/node_modules/@popperjs/core/lib/utils/userAgent.js +1 -1
  675. package/dist/cjs/node_modules/@popperjs/core/lib/utils/userAgent.js.map +1 -1
  676. package/dist/cjs/node_modules/@popperjs/core/lib/utils/within.js +0 -2
  677. package/dist/cjs/node_modules/@popperjs/core/lib/utils/within.js.map +1 -1
  678. package/dist/cjs/node_modules/@react-leaflet/core/lib/context.js +1 -4
  679. package/dist/cjs/node_modules/@react-leaflet/core/lib/context.js.map +1 -1
  680. package/dist/cjs/node_modules/axios/index.js +46 -0
  681. package/dist/cjs/node_modules/axios/index.js.map +1 -0
  682. package/dist/cjs/node_modules/axios/lib/adapters/adapters.js +9 -9
  683. package/dist/cjs/node_modules/axios/lib/adapters/adapters.js.map +1 -1
  684. package/dist/cjs/node_modules/axios/lib/adapters/fetch.js +24 -26
  685. package/dist/cjs/node_modules/axios/lib/adapters/fetch.js.map +1 -1
  686. package/dist/cjs/node_modules/axios/lib/adapters/xhr.js +16 -16
  687. package/dist/cjs/node_modules/axios/lib/adapters/xhr.js.map +1 -1
  688. package/dist/cjs/node_modules/axios/lib/axios.js +20 -23
  689. package/dist/cjs/node_modules/axios/lib/axios.js.map +1 -1
  690. package/dist/cjs/node_modules/axios/lib/cancel/CancelToken.js +2 -4
  691. package/dist/cjs/node_modules/axios/lib/cancel/CancelToken.js.map +1 -1
  692. package/dist/cjs/node_modules/axios/lib/cancel/CanceledError.js +3 -3
  693. package/dist/cjs/node_modules/axios/lib/cancel/CanceledError.js.map +1 -1
  694. package/dist/cjs/node_modules/axios/lib/cancel/isCancel.js +1 -1
  695. package/dist/cjs/node_modules/axios/lib/cancel/isCancel.js.map +1 -1
  696. package/dist/cjs/node_modules/axios/lib/core/Axios.js +21 -23
  697. package/dist/cjs/node_modules/axios/lib/core/Axios.js.map +1 -1
  698. package/dist/cjs/node_modules/axios/lib/core/AxiosError.js +4 -4
  699. package/dist/cjs/node_modules/axios/lib/core/AxiosError.js.map +1 -1
  700. package/dist/cjs/node_modules/axios/lib/core/AxiosHeaders.js +28 -30
  701. package/dist/cjs/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -1
  702. package/dist/cjs/node_modules/axios/lib/core/InterceptorManager.js +2 -4
  703. package/dist/cjs/node_modules/axios/lib/core/InterceptorManager.js.map +1 -1
  704. package/dist/cjs/node_modules/axios/lib/core/buildFullPath.js +3 -3
  705. package/dist/cjs/node_modules/axios/lib/core/buildFullPath.js.map +1 -1
  706. package/dist/cjs/node_modules/axios/lib/core/dispatchRequest.js +10 -10
  707. package/dist/cjs/node_modules/axios/lib/core/dispatchRequest.js.map +1 -1
  708. package/dist/cjs/node_modules/axios/lib/core/mergeConfig.js +14 -14
  709. package/dist/cjs/node_modules/axios/lib/core/mergeConfig.js.map +1 -1
  710. package/dist/cjs/node_modules/axios/lib/core/settle.js +3 -3
  711. package/dist/cjs/node_modules/axios/lib/core/settle.js.map +1 -1
  712. package/dist/cjs/node_modules/axios/lib/core/transformData.js +4 -4
  713. package/dist/cjs/node_modules/axios/lib/core/transformData.js.map +1 -1
  714. package/dist/cjs/node_modules/axios/lib/defaults/index.js +25 -27
  715. package/dist/cjs/node_modules/axios/lib/defaults/index.js.map +1 -1
  716. package/dist/cjs/node_modules/axios/lib/defaults/transitional.js +1 -1
  717. package/dist/cjs/node_modules/axios/lib/defaults/transitional.js.map +1 -1
  718. package/dist/cjs/node_modules/axios/lib/env/data.js +0 -2
  719. package/dist/cjs/node_modules/axios/lib/env/data.js.map +1 -1
  720. package/dist/cjs/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +2 -2
  721. package/dist/cjs/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -1
  722. package/dist/cjs/node_modules/axios/lib/helpers/HttpStatusCode.js +1 -3
  723. package/dist/cjs/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -1
  724. package/dist/cjs/node_modules/axios/lib/helpers/bind.js +1 -1
  725. package/dist/cjs/node_modules/axios/lib/helpers/bind.js.map +1 -1
  726. package/dist/cjs/node_modules/axios/lib/helpers/buildURL.js +4 -4
  727. package/dist/cjs/node_modules/axios/lib/helpers/buildURL.js.map +1 -1
  728. package/dist/cjs/node_modules/axios/lib/helpers/combineURLs.js +1 -1
  729. package/dist/cjs/node_modules/axios/lib/helpers/combineURLs.js.map +1 -1
  730. package/dist/cjs/node_modules/axios/lib/helpers/composeSignals.js +4 -6
  731. package/dist/cjs/node_modules/axios/lib/helpers/composeSignals.js.map +1 -1
  732. package/dist/cjs/node_modules/axios/lib/helpers/cookies.js +5 -5
  733. package/dist/cjs/node_modules/axios/lib/helpers/cookies.js.map +1 -1
  734. package/dist/cjs/node_modules/axios/lib/helpers/formDataToJSON.js +8 -8
  735. package/dist/cjs/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -1
  736. package/dist/cjs/node_modules/axios/lib/helpers/isAbsoluteURL.js +1 -1
  737. package/dist/cjs/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -1
  738. package/dist/cjs/node_modules/axios/lib/helpers/isAxiosError.js +2 -2
  739. package/dist/cjs/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -1
  740. package/dist/cjs/node_modules/axios/lib/helpers/isURLSameOrigin.js +5 -5
  741. package/dist/cjs/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -1
  742. package/dist/cjs/node_modules/axios/lib/helpers/null.js +1 -1
  743. package/dist/cjs/node_modules/axios/lib/helpers/null.js.map +1 -1
  744. package/dist/cjs/node_modules/axios/lib/helpers/parseHeaders.js +2 -2
  745. package/dist/cjs/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -1
  746. package/dist/cjs/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  747. package/dist/cjs/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -1
  748. package/dist/cjs/node_modules/axios/lib/helpers/progressEventReducer.js +3 -5
  749. package/dist/cjs/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -1
  750. package/dist/cjs/node_modules/axios/lib/helpers/resolveConfig.js +11 -11
  751. package/dist/cjs/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -1
  752. package/dist/cjs/node_modules/axios/lib/helpers/speedometer.js +1 -1
  753. package/dist/cjs/node_modules/axios/lib/helpers/speedometer.js.map +1 -1
  754. package/dist/cjs/node_modules/axios/lib/helpers/spread.js +1 -1
  755. package/dist/cjs/node_modules/axios/lib/helpers/spread.js.map +1 -1
  756. package/dist/cjs/node_modules/axios/lib/helpers/throttle.js +1 -1
  757. package/dist/cjs/node_modules/axios/lib/helpers/throttle.js.map +1 -1
  758. package/dist/cjs/node_modules/axios/lib/helpers/toFormData.js +24 -24
  759. package/dist/cjs/node_modules/axios/lib/helpers/toFormData.js.map +1 -1
  760. package/dist/cjs/node_modules/axios/lib/helpers/toURLEncodedForm.js +3 -3
  761. package/dist/cjs/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -1
  762. package/dist/cjs/node_modules/axios/lib/helpers/trackStream.js +1 -3
  763. package/dist/cjs/node_modules/axios/lib/helpers/trackStream.js.map +1 -1
  764. package/dist/cjs/node_modules/axios/lib/helpers/validator.js +6 -6
  765. package/dist/cjs/node_modules/axios/lib/helpers/validator.js.map +1 -1
  766. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/Blob.js +1 -1
  767. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -1
  768. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/FormData.js +1 -1
  769. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -1
  770. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +2 -2
  771. package/dist/cjs/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +1 -1
  772. package/dist/cjs/node_modules/axios/lib/platform/browser/index.js +4 -4
  773. package/dist/cjs/node_modules/axios/lib/platform/browser/index.js.map +1 -1
  774. package/dist/cjs/node_modules/axios/lib/platform/common/utils.js +0 -2
  775. package/dist/cjs/node_modules/axios/lib/platform/common/utils.js.map +1 -1
  776. package/dist/cjs/node_modules/axios/lib/platform/index.js +2 -2
  777. package/dist/cjs/node_modules/axios/lib/platform/index.js.map +1 -1
  778. package/dist/cjs/node_modules/axios/lib/utils.js +2 -2
  779. package/dist/cjs/node_modules/axios/lib/utils.js.map +1 -1
  780. package/dist/cjs/node_modules/clsx/dist/clsx.js +1 -1
  781. package/dist/cjs/node_modules/clsx/dist/clsx.js.map +1 -1
  782. package/dist/cjs/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +0 -2
  783. package/dist/cjs/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +1 -1
  784. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +1 -3
  785. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js.map +1 -1
  786. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js +0 -2
  787. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js.map +1 -1
  788. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -3
  789. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +1 -1
  790. package/dist/cjs/node_modules/mobx/dist/mobx.esm.js +5378 -0
  791. package/dist/cjs/node_modules/mobx/dist/mobx.esm.js.map +1 -0
  792. package/dist/cjs/node_modules/object-assign/index.js +0 -2
  793. package/dist/cjs/node_modules/object-assign/index.js.map +1 -1
  794. package/dist/cjs/node_modules/prop-types/checkPropTypes.js +0 -2
  795. package/dist/cjs/node_modules/prop-types/checkPropTypes.js.map +1 -1
  796. package/dist/cjs/node_modules/prop-types/factoryWithThrowingShims.js +0 -2
  797. package/dist/cjs/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -1
  798. package/dist/cjs/node_modules/prop-types/factoryWithTypeCheckers.js +0 -2
  799. package/dist/cjs/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
  800. package/dist/cjs/node_modules/prop-types/index.js +1 -3
  801. package/dist/cjs/node_modules/prop-types/index.js.map +1 -1
  802. package/dist/cjs/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -2
  803. package/dist/cjs/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -1
  804. package/dist/cjs/node_modules/prop-types/lib/has.js +0 -2
  805. package/dist/cjs/node_modules/prop-types/lib/has.js.map +1 -1
  806. package/dist/cjs/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -3
  807. package/dist/cjs/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -1
  808. package/dist/cjs/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -2
  809. package/dist/cjs/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -1
  810. package/dist/cjs/node_modules/prop-types/node_modules/react-is/index.js +1 -3
  811. package/dist/cjs/node_modules/prop-types/node_modules/react-is/index.js.map +1 -1
  812. package/dist/cjs/node_modules/react-hook-form/dist/index.esm.js +33 -41
  813. package/dist/cjs/node_modules/react-hook-form/dist/index.esm.js.map +1 -1
  814. package/dist/cjs/node_modules/react-is/cjs/react-is.development.js +145 -0
  815. package/dist/cjs/node_modules/react-is/cjs/react-is.development.js.map +1 -0
  816. package/dist/cjs/node_modules/react-is/cjs/react-is.production.js +142 -0
  817. package/dist/cjs/node_modules/react-is/cjs/react-is.production.js.map +1 -0
  818. package/dist/cjs/node_modules/react-is/index.js +22 -0
  819. package/dist/cjs/node_modules/react-is/index.js.map +1 -0
  820. package/dist/cjs/node_modules/react-leaflet/lib/hooks.js +0 -2
  821. package/dist/cjs/node_modules/react-leaflet/lib/hooks.js.map +1 -1
  822. package/dist/cjs/node_modules/react-transition-group/esm/Transition.js +31 -37
  823. package/dist/cjs/node_modules/react-transition-group/esm/Transition.js.map +1 -1
  824. package/dist/cjs/node_modules/react-transition-group/esm/TransitionGroup.js +16 -21
  825. package/dist/cjs/node_modules/react-transition-group/esm/TransitionGroup.js.map +1 -1
  826. package/dist/cjs/node_modules/react-transition-group/esm/TransitionGroupContext.js +2 -6
  827. package/dist/cjs/node_modules/react-transition-group/esm/TransitionGroupContext.js.map +1 -1
  828. package/dist/cjs/node_modules/react-transition-group/esm/config.js +1 -1
  829. package/dist/cjs/node_modules/react-transition-group/esm/config.js.map +1 -1
  830. package/dist/cjs/node_modules/react-transition-group/esm/utils/ChildMapping.js +0 -2
  831. package/dist/cjs/node_modules/react-transition-group/esm/utils/ChildMapping.js.map +1 -1
  832. package/dist/cjs/node_modules/react-transition-group/esm/utils/PropTypes.js +16 -18
  833. package/dist/cjs/node_modules/react-transition-group/esm/utils/PropTypes.js.map +1 -1
  834. package/dist/cjs/node_modules/react-transition-group/esm/utils/reflow.js +0 -2
  835. package/dist/cjs/node_modules/react-transition-group/esm/utils/reflow.js.map +1 -1
  836. package/dist/cjs/node_modules/stylis/src/Enum.js +0 -2
  837. package/dist/cjs/node_modules/stylis/src/Enum.js.map +1 -1
  838. package/dist/cjs/node_modules/stylis/src/Middleware.js +0 -2
  839. package/dist/cjs/node_modules/stylis/src/Middleware.js.map +1 -1
  840. package/dist/cjs/node_modules/stylis/src/Parser.js +0 -2
  841. package/dist/cjs/node_modules/stylis/src/Parser.js.map +1 -1
  842. package/dist/cjs/node_modules/stylis/src/Serializer.js +0 -2
  843. package/dist/cjs/node_modules/stylis/src/Serializer.js.map +1 -1
  844. package/dist/cjs/node_modules/stylis/src/Tokenizer.js +0 -2
  845. package/dist/cjs/node_modules/stylis/src/Tokenizer.js.map +1 -1
  846. package/dist/cjs/node_modules/stylis/src/Utility.js +0 -2
  847. package/dist/cjs/node_modules/stylis/src/Utility.js.map +1 -1
  848. package/dist/cjs/node_modules/tangram/dist/tangram.min.js +3 -9
  849. package/dist/cjs/node_modules/tangram/dist/tangram.min.js.map +1 -1
  850. package/dist/cjs/services/api/api.service.js +2 -3
  851. package/dist/cjs/services/api/api.service.js.map +1 -1
  852. package/dist/esm/_virtual/index.js +1 -1
  853. package/dist/esm/_virtual/index2.js +1 -1
  854. package/dist/esm/_virtual/index3.js +1 -1
  855. package/dist/esm/_virtual/index5.js +1 -1
  856. package/dist/esm/components/buttons/delete/delete.js.map +1 -1
  857. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  858. package/dist/esm/components/drag-list/drag-list.js +1 -1
  859. package/dist/esm/components/drag-list/drag-list.js.map +1 -1
  860. package/dist/esm/components/drag-list/draggable/draggable.js.map +1 -1
  861. package/dist/esm/components/form/form.js.map +1 -1
  862. package/dist/esm/components/input/input.js.map +1 -1
  863. package/dist/esm/components/layers/leaflet/hooks/useGetLeafletLayer.js +1 -1
  864. package/dist/esm/components/layers/leaflet/hooks/useGetLeafletLayer.js.map +1 -1
  865. package/dist/esm/components/layers/leaflet/leaflet.js +1 -1
  866. package/dist/esm/components/layers/leaflet/leaflet.js.map +1 -1
  867. package/dist/esm/components/list/list.js.map +1 -1
  868. package/dist/esm/components/no-data/no-data.js.map +1 -1
  869. package/dist/esm/components/paragraph/paragraph.js.map +1 -1
  870. package/dist/esm/components/select/select.js.map +1 -1
  871. package/dist/esm/configs/global/constants.js.map +1 -1
  872. package/dist/esm/configs/global/global.js +1 -1
  873. package/dist/esm/configs/global/global.js.map +1 -1
  874. package/dist/esm/constants/api.js.map +1 -1
  875. package/dist/esm/constants/map.js.map +1 -1
  876. package/dist/esm/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -1
  877. package/dist/esm/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -1
  878. package/dist/esm/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -1
  879. package/dist/esm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
  880. package/dist/esm/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -1
  881. package/dist/esm/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +1 -1
  882. package/dist/esm/node_modules/@dnd-kit/core/dist/core.esm.js +1 -1
  883. package/dist/esm/node_modules/@dnd-kit/core/dist/core.esm.js.map +1 -1
  884. package/dist/esm/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +1 -1
  885. package/dist/esm/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
  886. package/dist/esm/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +1 -1
  887. package/dist/esm/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +1 -1
  888. package/dist/esm/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js.map +1 -1
  889. package/dist/esm/node_modules/@emotion/hash/dist/emotion-hash.esm.js.map +1 -1
  890. package/dist/esm/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +1 -1
  891. package/dist/esm/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js.map +1 -1
  892. package/dist/esm/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js.map +1 -1
  893. package/dist/esm/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +1 -1
  894. package/dist/esm/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js.map +1 -1
  895. package/dist/esm/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +1 -1
  896. package/dist/esm/node_modules/@emotion/react/dist/emotion-react.browser.esm.js.map +1 -1
  897. package/dist/esm/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js.map +1 -1
  898. package/dist/esm/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js.map +1 -1
  899. package/dist/esm/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js.map +1 -1
  900. package/dist/esm/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js.map +1 -1
  901. package/dist/esm/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +1 -1
  902. package/dist/esm/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js.map +1 -1
  903. package/dist/esm/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js.map +1 -1
  904. package/dist/esm/node_modules/@mui/material/esm/Autocomplete/Autocomplete.js +1 -1
  905. package/dist/esm/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js +1 -1
  906. package/dist/esm/node_modules/@mui/material/esm/Autocomplete/autocompleteClasses.js.map +1 -1
  907. package/dist/esm/node_modules/@mui/material/esm/Backdrop/Backdrop.js +1 -1
  908. package/dist/esm/node_modules/@mui/material/esm/Backdrop/backdropClasses.js.map +1 -1
  909. package/dist/esm/node_modules/@mui/material/esm/Box/Box.js +1 -1
  910. package/dist/esm/node_modules/@mui/material/esm/Box/boxClasses.js +1 -1
  911. package/dist/esm/node_modules/@mui/material/esm/Box/boxClasses.js.map +1 -1
  912. package/dist/esm/node_modules/@mui/material/esm/Button/Button.js +1 -1
  913. package/dist/esm/node_modules/@mui/material/esm/Button/buttonClasses.js +1 -1
  914. package/dist/esm/node_modules/@mui/material/esm/Button/buttonClasses.js.map +1 -1
  915. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/ButtonBase.js +1 -1
  916. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/Ripple.js +1 -1
  917. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js +5 -5
  918. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/TouchRipple.js.map +1 -1
  919. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js +1 -1
  920. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/buttonBaseClasses.js.map +1 -1
  921. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js +1 -1
  922. package/dist/esm/node_modules/@mui/material/esm/ButtonBase/touchRippleClasses.js.map +1 -1
  923. package/dist/esm/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupButtonContext.js +1 -1
  924. package/dist/esm/node_modules/@mui/material/esm/ButtonGroup/ButtonGroupContext.js +1 -1
  925. package/dist/esm/node_modules/@mui/material/esm/Checkbox/Checkbox.js +1 -1
  926. package/dist/esm/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js +1 -1
  927. package/dist/esm/node_modules/@mui/material/esm/Checkbox/checkboxClasses.js.map +1 -1
  928. package/dist/esm/node_modules/@mui/material/esm/Chip/Chip.js +1 -1
  929. package/dist/esm/node_modules/@mui/material/esm/Chip/chipClasses.js +1 -1
  930. package/dist/esm/node_modules/@mui/material/esm/Chip/chipClasses.js.map +1 -1
  931. package/dist/esm/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js +7 -7
  932. package/dist/esm/node_modules/@mui/material/esm/CircularProgress/CircularProgress.js.map +1 -1
  933. package/dist/esm/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js +1 -1
  934. package/dist/esm/node_modules/@mui/material/esm/CircularProgress/circularProgressClasses.js.map +1 -1
  935. package/dist/esm/node_modules/@mui/material/esm/DefaultPropsProvider/DefaultPropsProvider.js +1 -1
  936. package/dist/esm/node_modules/@mui/material/esm/Dialog/Dialog.js +1 -1
  937. package/dist/esm/node_modules/@mui/material/esm/Dialog/DialogContext.js +1 -1
  938. package/dist/esm/node_modules/@mui/material/esm/Dialog/dialogClasses.js +1 -1
  939. package/dist/esm/node_modules/@mui/material/esm/Dialog/dialogClasses.js.map +1 -1
  940. package/dist/esm/node_modules/@mui/material/esm/DialogActions/DialogActions.js +1 -1
  941. package/dist/esm/node_modules/@mui/material/esm/DialogActions/dialogActionsClasses.js.map +1 -1
  942. package/dist/esm/node_modules/@mui/material/esm/DialogContent/DialogContent.js +1 -1
  943. package/dist/esm/node_modules/@mui/material/esm/DialogContent/dialogContentClasses.js.map +1 -1
  944. package/dist/esm/node_modules/@mui/material/esm/DialogContentText/DialogContentText.js +1 -1
  945. package/dist/esm/node_modules/@mui/material/esm/DialogContentText/dialogContentTextClasses.js.map +1 -1
  946. package/dist/esm/node_modules/@mui/material/esm/DialogTitle/DialogTitle.js +1 -1
  947. package/dist/esm/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js +1 -1
  948. package/dist/esm/node_modules/@mui/material/esm/DialogTitle/dialogTitleClasses.js.map +1 -1
  949. package/dist/esm/node_modules/@mui/material/esm/Fade/Fade.js +1 -1
  950. package/dist/esm/node_modules/@mui/material/esm/FilledInput/FilledInput.js +1 -1
  951. package/dist/esm/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js +1 -1
  952. package/dist/esm/node_modules/@mui/material/esm/FilledInput/filledInputClasses.js.map +1 -1
  953. package/dist/esm/node_modules/@mui/material/esm/FormControl/FormControl.js +1 -1
  954. package/dist/esm/node_modules/@mui/material/esm/FormControl/FormControlContext.js +1 -1
  955. package/dist/esm/node_modules/@mui/material/esm/FormControl/formControlClasses.js.map +1 -1
  956. package/dist/esm/node_modules/@mui/material/esm/FormControl/formControlState.js.map +1 -1
  957. package/dist/esm/node_modules/@mui/material/esm/FormControlLabel/FormControlLabel.js +1 -1
  958. package/dist/esm/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js +1 -1
  959. package/dist/esm/node_modules/@mui/material/esm/FormControlLabel/formControlLabelClasses.js.map +1 -1
  960. package/dist/esm/node_modules/@mui/material/esm/FormHelperText/FormHelperText.js +1 -1
  961. package/dist/esm/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js +1 -1
  962. package/dist/esm/node_modules/@mui/material/esm/FormHelperText/formHelperTextClasses.js.map +1 -1
  963. package/dist/esm/node_modules/@mui/material/esm/FormLabel/FormLabel.js +1 -1
  964. package/dist/esm/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js +1 -1
  965. package/dist/esm/node_modules/@mui/material/esm/FormLabel/formLabelClasses.js.map +1 -1
  966. package/dist/esm/node_modules/@mui/material/esm/GlobalStyles/GlobalStyles.js +1 -1
  967. package/dist/esm/node_modules/@mui/material/esm/Grow/Grow.js +1 -1
  968. package/dist/esm/node_modules/@mui/material/esm/IconButton/IconButton.js +1 -1
  969. package/dist/esm/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js +1 -1
  970. package/dist/esm/node_modules/@mui/material/esm/IconButton/iconButtonClasses.js.map +1 -1
  971. package/dist/esm/node_modules/@mui/material/esm/Input/Input.js +1 -1
  972. package/dist/esm/node_modules/@mui/material/esm/Input/inputClasses.js +1 -1
  973. package/dist/esm/node_modules/@mui/material/esm/Input/inputClasses.js.map +1 -1
  974. package/dist/esm/node_modules/@mui/material/esm/InputBase/InputBase.js +1 -1
  975. package/dist/esm/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js +1 -1
  976. package/dist/esm/node_modules/@mui/material/esm/InputBase/inputBaseClasses.js.map +1 -1
  977. package/dist/esm/node_modules/@mui/material/esm/InputBase/utils.js.map +1 -1
  978. package/dist/esm/node_modules/@mui/material/esm/InputLabel/InputLabel.js +1 -1
  979. package/dist/esm/node_modules/@mui/material/esm/InputLabel/inputLabelClasses.js.map +1 -1
  980. package/dist/esm/node_modules/@mui/material/esm/List/List.js +1 -1
  981. package/dist/esm/node_modules/@mui/material/esm/List/ListContext.js +1 -1
  982. package/dist/esm/node_modules/@mui/material/esm/List/listClasses.js.map +1 -1
  983. package/dist/esm/node_modules/@mui/material/esm/ListItem/ListItem.js +1 -1
  984. package/dist/esm/node_modules/@mui/material/esm/ListItem/listItemClasses.js.map +1 -1
  985. package/dist/esm/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js +1 -1
  986. package/dist/esm/node_modules/@mui/material/esm/ListItemButton/listItemButtonClasses.js.map +1 -1
  987. package/dist/esm/node_modules/@mui/material/esm/ListItemSecondaryAction/ListItemSecondaryAction.js +1 -1
  988. package/dist/esm/node_modules/@mui/material/esm/ListItemSecondaryAction/listItemSecondaryActionClasses.js.map +1 -1
  989. package/dist/esm/node_modules/@mui/material/esm/ListSubheader/ListSubheader.js +1 -1
  990. package/dist/esm/node_modules/@mui/material/esm/ListSubheader/listSubheaderClasses.js.map +1 -1
  991. package/dist/esm/node_modules/@mui/material/esm/Menu/Menu.js +1 -1
  992. package/dist/esm/node_modules/@mui/material/esm/Menu/menuClasses.js.map +1 -1
  993. package/dist/esm/node_modules/@mui/material/esm/MenuList/MenuList.js +1 -1
  994. package/dist/esm/node_modules/@mui/material/esm/Modal/Modal.js +1 -1
  995. package/dist/esm/node_modules/@mui/material/esm/Modal/ModalManager.js.map +1 -1
  996. package/dist/esm/node_modules/@mui/material/esm/Modal/modalClasses.js.map +1 -1
  997. package/dist/esm/node_modules/@mui/material/esm/Modal/useModal.js +1 -1
  998. package/dist/esm/node_modules/@mui/material/esm/NativeSelect/NativeSelectInput.js +1 -1
  999. package/dist/esm/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js +1 -1
  1000. package/dist/esm/node_modules/@mui/material/esm/NativeSelect/nativeSelectClasses.js.map +1 -1
  1001. package/dist/esm/node_modules/@mui/material/esm/OutlinedInput/NotchedOutline.js +1 -1
  1002. package/dist/esm/node_modules/@mui/material/esm/OutlinedInput/OutlinedInput.js +1 -1
  1003. package/dist/esm/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js +1 -1
  1004. package/dist/esm/node_modules/@mui/material/esm/OutlinedInput/outlinedInputClasses.js.map +1 -1
  1005. package/dist/esm/node_modules/@mui/material/esm/Paper/Paper.js +1 -1
  1006. package/dist/esm/node_modules/@mui/material/esm/Paper/paperClasses.js.map +1 -1
  1007. package/dist/esm/node_modules/@mui/material/esm/Popover/Popover.js +1 -1
  1008. package/dist/esm/node_modules/@mui/material/esm/Popover/popoverClasses.js.map +1 -1
  1009. package/dist/esm/node_modules/@mui/material/esm/Popper/BasePopper.js +1 -1
  1010. package/dist/esm/node_modules/@mui/material/esm/Popper/Popper.js +1 -1
  1011. package/dist/esm/node_modules/@mui/material/esm/Popper/popperClasses.js.map +1 -1
  1012. package/dist/esm/node_modules/@mui/material/esm/Portal/Portal.js +1 -1
  1013. package/dist/esm/node_modules/@mui/material/esm/Select/Select.js +1 -1
  1014. package/dist/esm/node_modules/@mui/material/esm/Select/SelectInput.js +1 -1
  1015. package/dist/esm/node_modules/@mui/material/esm/Select/selectClasses.js.map +1 -1
  1016. package/dist/esm/node_modules/@mui/material/esm/Slide/Slide.js +1 -1
  1017. package/dist/esm/node_modules/@mui/material/esm/SvgIcon/SvgIcon.js +1 -1
  1018. package/dist/esm/node_modules/@mui/material/esm/SvgIcon/svgIconClasses.js.map +1 -1
  1019. package/dist/esm/node_modules/@mui/material/esm/TextField/TextField.js +1 -1
  1020. package/dist/esm/node_modules/@mui/material/esm/TextField/textFieldClasses.js.map +1 -1
  1021. package/dist/esm/node_modules/@mui/material/esm/TextareaAutosize/TextareaAutosize.js +1 -1
  1022. package/dist/esm/node_modules/@mui/material/esm/Typography/Typography.js +1 -1
  1023. package/dist/esm/node_modules/@mui/material/esm/Typography/typographyClasses.js.map +1 -1
  1024. package/dist/esm/node_modules/@mui/material/esm/Unstable_TrapFocus/FocusTrap.js +1 -1
  1025. package/dist/esm/node_modules/@mui/material/esm/colors/blue.js +1 -1
  1026. package/dist/esm/node_modules/@mui/material/esm/colors/blue.js.map +1 -1
  1027. package/dist/esm/node_modules/@mui/material/esm/colors/common.js +1 -1
  1028. package/dist/esm/node_modules/@mui/material/esm/colors/common.js.map +1 -1
  1029. package/dist/esm/node_modules/@mui/material/esm/colors/green.js +1 -1
  1030. package/dist/esm/node_modules/@mui/material/esm/colors/green.js.map +1 -1
  1031. package/dist/esm/node_modules/@mui/material/esm/colors/grey.js +1 -1
  1032. package/dist/esm/node_modules/@mui/material/esm/colors/grey.js.map +1 -1
  1033. package/dist/esm/node_modules/@mui/material/esm/colors/lightBlue.js +1 -1
  1034. package/dist/esm/node_modules/@mui/material/esm/colors/lightBlue.js.map +1 -1
  1035. package/dist/esm/node_modules/@mui/material/esm/colors/orange.js +1 -1
  1036. package/dist/esm/node_modules/@mui/material/esm/colors/orange.js.map +1 -1
  1037. package/dist/esm/node_modules/@mui/material/esm/colors/purple.js +1 -1
  1038. package/dist/esm/node_modules/@mui/material/esm/colors/purple.js.map +1 -1
  1039. package/dist/esm/node_modules/@mui/material/esm/colors/red.js +1 -1
  1040. package/dist/esm/node_modules/@mui/material/esm/colors/red.js.map +1 -1
  1041. package/dist/esm/node_modules/@mui/material/esm/internal/SwitchBase.js +1 -1
  1042. package/dist/esm/node_modules/@mui/material/esm/internal/switchBaseClasses.js.map +1 -1
  1043. package/dist/esm/node_modules/@mui/material/esm/styles/createColorScheme.js.map +1 -1
  1044. package/dist/esm/node_modules/@mui/material/esm/styles/createGetSelector.js.map +1 -1
  1045. package/dist/esm/node_modules/@mui/material/esm/styles/createMixins.js.map +1 -1
  1046. package/dist/esm/node_modules/@mui/material/esm/styles/createPalette.js.map +1 -1
  1047. package/dist/esm/node_modules/@mui/material/esm/styles/createTheme.js.map +1 -1
  1048. package/dist/esm/node_modules/@mui/material/esm/styles/createThemeNoVars.js +1 -1
  1049. package/dist/esm/node_modules/@mui/material/esm/styles/createThemeNoVars.js.map +1 -1
  1050. package/dist/esm/node_modules/@mui/material/esm/styles/createThemeWithVars.js +1 -1
  1051. package/dist/esm/node_modules/@mui/material/esm/styles/createThemeWithVars.js.map +1 -1
  1052. package/dist/esm/node_modules/@mui/material/esm/styles/createTransitions.js.map +1 -1
  1053. package/dist/esm/node_modules/@mui/material/esm/styles/createTypography.js.map +1 -1
  1054. package/dist/esm/node_modules/@mui/material/esm/styles/defaultTheme.js +1 -1
  1055. package/dist/esm/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js +1 -1
  1056. package/dist/esm/node_modules/@mui/material/esm/styles/excludeVariablesFromRoot.js.map +1 -1
  1057. package/dist/esm/node_modules/@mui/material/esm/styles/getOverlayAlpha.js.map +1 -1
  1058. package/dist/esm/node_modules/@mui/material/esm/styles/identifier.js.map +1 -1
  1059. package/dist/esm/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js +1 -1
  1060. package/dist/esm/node_modules/@mui/material/esm/styles/rootShouldForwardProp.js.map +1 -1
  1061. package/dist/esm/node_modules/@mui/material/esm/styles/shadows.js +1 -1
  1062. package/dist/esm/node_modules/@mui/material/esm/styles/shadows.js.map +1 -1
  1063. package/dist/esm/node_modules/@mui/material/esm/styles/shouldSkipGeneratingVar.js.map +1 -1
  1064. package/dist/esm/node_modules/@mui/material/esm/styles/slotShouldForwardProp.js.map +1 -1
  1065. package/dist/esm/node_modules/@mui/material/esm/styles/stringifyTheme.js.map +1 -1
  1066. package/dist/esm/node_modules/@mui/material/esm/styles/styled.js +1 -1
  1067. package/dist/esm/node_modules/@mui/material/esm/styles/zIndex.js +1 -1
  1068. package/dist/esm/node_modules/@mui/material/esm/styles/zIndex.js.map +1 -1
  1069. package/dist/esm/node_modules/@mui/material/esm/transitions/utils.js.map +1 -1
  1070. package/dist/esm/node_modules/@mui/material/esm/useAutocomplete/useAutocomplete.js +1 -1
  1071. package/dist/esm/node_modules/@mui/material/esm/utils/capitalize.js +1 -1
  1072. package/dist/esm/node_modules/@mui/material/esm/utils/createSimplePaletteValueFilter.js.map +1 -1
  1073. package/dist/esm/node_modules/@mui/material/esm/utils/debounce.js +1 -1
  1074. package/dist/esm/node_modules/@mui/material/esm/utils/getScrollbarSize.js +1 -1
  1075. package/dist/esm/node_modules/@mui/material/esm/utils/isMuiElement.js +1 -1
  1076. package/dist/esm/node_modules/@mui/material/esm/utils/memoTheme.js +1 -1
  1077. package/dist/esm/node_modules/@mui/material/esm/utils/memoTheme.js.map +1 -1
  1078. package/dist/esm/node_modules/@mui/material/esm/utils/mergeSlotProps.js.map +1 -1
  1079. package/dist/esm/node_modules/@mui/material/esm/utils/ownerDocument.js +1 -1
  1080. package/dist/esm/node_modules/@mui/material/esm/utils/ownerWindow.js +1 -1
  1081. package/dist/esm/node_modules/@mui/material/esm/utils/unsupportedProp.js +1 -1
  1082. package/dist/esm/node_modules/@mui/material/esm/utils/useControlled.js +1 -1
  1083. package/dist/esm/node_modules/@mui/material/esm/utils/useEnhancedEffect.js +1 -1
  1084. package/dist/esm/node_modules/@mui/material/esm/utils/useEventCallback.js +1 -1
  1085. package/dist/esm/node_modules/@mui/material/esm/utils/useForkRef.js +1 -1
  1086. package/dist/esm/node_modules/@mui/material/esm/utils/useId.js +1 -1
  1087. package/dist/esm/node_modules/@mui/material/esm/zero-styled/index.js.map +1 -1
  1088. package/dist/esm/node_modules/@mui/styled-engine/esm/GlobalStyles/GlobalStyles.js +1 -1
  1089. package/dist/esm/node_modules/@mui/styled-engine/esm/index.js +1 -1
  1090. package/dist/esm/node_modules/@mui/styled-engine/esm/index.js.map +1 -1
  1091. package/dist/esm/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js +1 -1
  1092. package/dist/esm/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js +1 -1
  1093. package/dist/esm/node_modules/@mui/system/esm/RtlProvider/index.js +1 -1
  1094. package/dist/esm/node_modules/@mui/system/esm/borders/borders.js.map +1 -1
  1095. package/dist/esm/node_modules/@mui/system/esm/breakpoints/breakpoints.js.map +1 -1
  1096. package/dist/esm/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js +1 -1
  1097. package/dist/esm/node_modules/@mui/system/esm/colorManipulator/colorManipulator.js.map +1 -1
  1098. package/dist/esm/node_modules/@mui/system/esm/compose/compose.js.map +1 -1
  1099. package/dist/esm/node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js.map +1 -1
  1100. package/dist/esm/node_modules/@mui/system/esm/createStyled/createStyled.js.map +1 -1
  1101. package/dist/esm/node_modules/@mui/system/esm/createTheme/applyStyles.js.map +1 -1
  1102. package/dist/esm/node_modules/@mui/system/esm/createTheme/createSpacing.js.map +1 -1
  1103. package/dist/esm/node_modules/@mui/system/esm/createTheme/createTheme.js.map +1 -1
  1104. package/dist/esm/node_modules/@mui/system/esm/createTheme/shape.js +1 -1
  1105. package/dist/esm/node_modules/@mui/system/esm/createTheme/shape.js.map +1 -1
  1106. package/dist/esm/node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js.map +1 -1
  1107. package/dist/esm/node_modules/@mui/system/esm/cssGrid/cssGrid.js.map +1 -1
  1108. package/dist/esm/node_modules/@mui/system/esm/cssVars/createGetCssVar.js.map +1 -1
  1109. package/dist/esm/node_modules/@mui/system/esm/cssVars/cssVarsParser.js.map +1 -1
  1110. package/dist/esm/node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js.map +1 -1
  1111. package/dist/esm/node_modules/@mui/system/esm/cssVars/prepareCssVars.js.map +1 -1
  1112. package/dist/esm/node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js.map +1 -1
  1113. package/dist/esm/node_modules/@mui/system/esm/memoTheme.js.map +1 -1
  1114. package/dist/esm/node_modules/@mui/system/esm/memoize/memoize.js.map +1 -1
  1115. package/dist/esm/node_modules/@mui/system/esm/merge/merge.js.map +1 -1
  1116. package/dist/esm/node_modules/@mui/system/esm/palette/palette.js.map +1 -1
  1117. package/dist/esm/node_modules/@mui/system/esm/preprocessStyles.js.map +1 -1
  1118. package/dist/esm/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js +1 -1
  1119. package/dist/esm/node_modules/@mui/system/esm/responsivePropType/responsivePropType.js.map +1 -1
  1120. package/dist/esm/node_modules/@mui/system/esm/sizing/sizing.js.map +1 -1
  1121. package/dist/esm/node_modules/@mui/system/esm/spacing/spacing.js +1 -1
  1122. package/dist/esm/node_modules/@mui/system/esm/spacing/spacing.js.map +1 -1
  1123. package/dist/esm/node_modules/@mui/system/esm/style/style.js.map +1 -1
  1124. package/dist/esm/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +1 -1
  1125. package/dist/esm/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js.map +1 -1
  1126. package/dist/esm/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js.map +1 -1
  1127. package/dist/esm/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +1 -1
  1128. package/dist/esm/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js.map +1 -1
  1129. package/dist/esm/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js +1 -1
  1130. package/dist/esm/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js.map +1 -1
  1131. package/dist/esm/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js.map +1 -1
  1132. package/dist/esm/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js.map +1 -1
  1133. package/dist/esm/node_modules/@mui/utils/esm/capitalize/capitalize.js.map +1 -1
  1134. package/dist/esm/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js.map +1 -1
  1135. package/dist/esm/node_modules/@mui/utils/esm/clamp/clamp.js.map +1 -1
  1136. package/dist/esm/node_modules/@mui/utils/esm/composeClasses/composeClasses.js.map +1 -1
  1137. package/dist/esm/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js.map +1 -1
  1138. package/dist/esm/node_modules/@mui/utils/esm/debounce/debounce.js.map +1 -1
  1139. package/dist/esm/node_modules/@mui/utils/esm/deepmerge/deepmerge.js +1 -1
  1140. package/dist/esm/node_modules/@mui/utils/esm/deepmerge/deepmerge.js.map +1 -1
  1141. package/dist/esm/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js +1 -1
  1142. package/dist/esm/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js.map +1 -1
  1143. package/dist/esm/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js +1 -1
  1144. package/dist/esm/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js.map +1 -1
  1145. package/dist/esm/node_modules/@mui/utils/esm/exactProp/exactProp.js.map +1 -1
  1146. package/dist/esm/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js.map +1 -1
  1147. package/dist/esm/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js.map +1 -1
  1148. package/dist/esm/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js.map +1 -1
  1149. package/dist/esm/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js.map +1 -1
  1150. package/dist/esm/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js +1 -1
  1151. package/dist/esm/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js.map +1 -1
  1152. package/dist/esm/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js.map +1 -1
  1153. package/dist/esm/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js.map +1 -1
  1154. package/dist/esm/node_modules/@mui/utils/esm/integerPropType/integerPropType.js +1 -1
  1155. package/dist/esm/node_modules/@mui/utils/esm/integerPropType/integerPropType.js.map +1 -1
  1156. package/dist/esm/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js +1 -1
  1157. package/dist/esm/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js.map +1 -1
  1158. package/dist/esm/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js.map +1 -1
  1159. package/dist/esm/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js.map +1 -1
  1160. package/dist/esm/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js.map +1 -1
  1161. package/dist/esm/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js.map +1 -1
  1162. package/dist/esm/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js.map +1 -1
  1163. package/dist/esm/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js.map +1 -1
  1164. package/dist/esm/node_modules/@mui/utils/esm/refType/refType.js +1 -1
  1165. package/dist/esm/node_modules/@mui/utils/esm/refType/refType.js.map +1 -1
  1166. package/dist/esm/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js.map +1 -1
  1167. package/dist/esm/node_modules/@mui/utils/esm/resolveProps/resolveProps.js.map +1 -1
  1168. package/dist/esm/node_modules/@mui/utils/esm/setRef/setRef.js.map +1 -1
  1169. package/dist/esm/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js.map +1 -1
  1170. package/dist/esm/node_modules/@mui/utils/esm/useControlled/useControlled.js +1 -1
  1171. package/dist/esm/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +1 -1
  1172. package/dist/esm/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js +1 -1
  1173. package/dist/esm/node_modules/@popperjs/core/lib/createPopper.js.map +1 -1
  1174. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/contains.js.map +1 -1
  1175. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js.map +1 -1
  1176. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +1 -1
  1177. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js.map +1 -1
  1178. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js.map +1 -1
  1179. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js.map +1 -1
  1180. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js.map +1 -1
  1181. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js.map +1 -1
  1182. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js.map +1 -1
  1183. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js.map +1 -1
  1184. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js.map +1 -1
  1185. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js.map +1 -1
  1186. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js.map +1 -1
  1187. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js.map +1 -1
  1188. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js.map +1 -1
  1189. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js.map +1 -1
  1190. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getWindow.js.map +1 -1
  1191. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js.map +1 -1
  1192. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js.map +1 -1
  1193. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js.map +1 -1
  1194. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js.map +1 -1
  1195. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js.map +1 -1
  1196. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js.map +1 -1
  1197. package/dist/esm/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js.map +1 -1
  1198. package/dist/esm/node_modules/@popperjs/core/lib/enums.js.map +1 -1
  1199. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/applyStyles.js.map +1 -1
  1200. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/arrow.js.map +1 -1
  1201. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/computeStyles.js.map +1 -1
  1202. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/eventListeners.js.map +1 -1
  1203. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/flip.js.map +1 -1
  1204. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/hide.js.map +1 -1
  1205. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/offset.js.map +1 -1
  1206. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +1 -1
  1207. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js.map +1 -1
  1208. package/dist/esm/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js.map +1 -1
  1209. package/dist/esm/node_modules/@popperjs/core/lib/popper.js +1 -1
  1210. package/dist/esm/node_modules/@popperjs/core/lib/popper.js.map +1 -1
  1211. package/dist/esm/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js.map +1 -1
  1212. package/dist/esm/node_modules/@popperjs/core/lib/utils/computeOffsets.js.map +1 -1
  1213. package/dist/esm/node_modules/@popperjs/core/lib/utils/debounce.js.map +1 -1
  1214. package/dist/esm/node_modules/@popperjs/core/lib/utils/detectOverflow.js +1 -1
  1215. package/dist/esm/node_modules/@popperjs/core/lib/utils/detectOverflow.js.map +1 -1
  1216. package/dist/esm/node_modules/@popperjs/core/lib/utils/expandToHashMap.js.map +1 -1
  1217. package/dist/esm/node_modules/@popperjs/core/lib/utils/getAltAxis.js.map +1 -1
  1218. package/dist/esm/node_modules/@popperjs/core/lib/utils/getBasePlacement.js.map +1 -1
  1219. package/dist/esm/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js.map +1 -1
  1220. package/dist/esm/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js.map +1 -1
  1221. package/dist/esm/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js.map +1 -1
  1222. package/dist/esm/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js.map +1 -1
  1223. package/dist/esm/node_modules/@popperjs/core/lib/utils/getVariation.js.map +1 -1
  1224. package/dist/esm/node_modules/@popperjs/core/lib/utils/math.js.map +1 -1
  1225. package/dist/esm/node_modules/@popperjs/core/lib/utils/mergeByName.js.map +1 -1
  1226. package/dist/esm/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js.map +1 -1
  1227. package/dist/esm/node_modules/@popperjs/core/lib/utils/orderModifiers.js.map +1 -1
  1228. package/dist/esm/node_modules/@popperjs/core/lib/utils/rectToClientRect.js.map +1 -1
  1229. package/dist/esm/node_modules/@popperjs/core/lib/utils/userAgent.js.map +1 -1
  1230. package/dist/esm/node_modules/@popperjs/core/lib/utils/within.js.map +1 -1
  1231. package/dist/esm/node_modules/@react-leaflet/core/lib/context.js +1 -1
  1232. package/dist/esm/node_modules/@react-leaflet/core/lib/context.js.map +1 -1
  1233. package/dist/esm/node_modules/axios/index.js +2 -0
  1234. package/dist/esm/node_modules/axios/index.js.map +1 -0
  1235. package/dist/esm/node_modules/axios/lib/adapters/adapters.js.map +1 -1
  1236. package/dist/esm/node_modules/axios/lib/adapters/fetch.js.map +1 -1
  1237. package/dist/esm/node_modules/axios/lib/adapters/xhr.js.map +1 -1
  1238. package/dist/esm/node_modules/axios/lib/axios.js +1 -1
  1239. package/dist/esm/node_modules/axios/lib/cancel/CancelToken.js +1 -1
  1240. package/dist/esm/node_modules/axios/lib/cancel/isCancel.js.map +1 -1
  1241. package/dist/esm/node_modules/axios/lib/core/Axios.js +1 -1
  1242. package/dist/esm/node_modules/axios/lib/core/AxiosHeaders.js +1 -1
  1243. package/dist/esm/node_modules/axios/lib/core/InterceptorManager.js +1 -1
  1244. package/dist/esm/node_modules/axios/lib/defaults/index.js +1 -1
  1245. package/dist/esm/node_modules/axios/lib/defaults/transitional.js.map +1 -1
  1246. package/dist/esm/node_modules/axios/lib/env/data.js.map +1 -1
  1247. package/dist/esm/node_modules/axios/lib/helpers/HttpStatusCode.js +1 -1
  1248. package/dist/esm/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -1
  1249. package/dist/esm/node_modules/axios/lib/helpers/bind.js.map +1 -1
  1250. package/dist/esm/node_modules/axios/lib/helpers/combineURLs.js.map +1 -1
  1251. package/dist/esm/node_modules/axios/lib/helpers/composeSignals.js +1 -1
  1252. package/dist/esm/node_modules/axios/lib/helpers/composeSignals.js.map +1 -1
  1253. package/dist/esm/node_modules/axios/lib/helpers/cookies.js.map +1 -1
  1254. package/dist/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -1
  1255. package/dist/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -1
  1256. package/dist/esm/node_modules/axios/lib/helpers/null.js.map +1 -1
  1257. package/dist/esm/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -1
  1258. package/dist/esm/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -1
  1259. package/dist/esm/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -1
  1260. package/dist/esm/node_modules/axios/lib/helpers/speedometer.js.map +1 -1
  1261. package/dist/esm/node_modules/axios/lib/helpers/spread.js.map +1 -1
  1262. package/dist/esm/node_modules/axios/lib/helpers/throttle.js.map +1 -1
  1263. package/dist/esm/node_modules/axios/lib/helpers/trackStream.js +1 -1
  1264. package/dist/esm/node_modules/axios/lib/helpers/trackStream.js.map +1 -1
  1265. package/dist/esm/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -1
  1266. package/dist/esm/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -1
  1267. package/dist/esm/node_modules/axios/lib/platform/browser/index.js.map +1 -1
  1268. package/dist/esm/node_modules/axios/lib/platform/common/utils.js.map +1 -1
  1269. package/dist/esm/node_modules/axios/lib/platform/index.js.map +1 -1
  1270. package/dist/esm/node_modules/clsx/dist/clsx.js.map +1 -1
  1271. package/dist/esm/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +1 -1
  1272. package/dist/esm/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +1 -1
  1273. package/dist/esm/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js.map +1 -1
  1274. package/dist/esm/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js.map +1 -1
  1275. package/dist/esm/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  1276. package/dist/esm/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +1 -1
  1277. package/dist/esm/node_modules/mobx/dist/mobx.esm.js +2 -0
  1278. package/dist/esm/node_modules/mobx/dist/mobx.esm.js.map +1 -0
  1279. package/dist/esm/node_modules/object-assign/index.js.map +1 -1
  1280. package/dist/esm/node_modules/prop-types/checkPropTypes.js.map +1 -1
  1281. package/dist/esm/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -1
  1282. package/dist/esm/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
  1283. package/dist/esm/node_modules/prop-types/index.js +1 -1
  1284. package/dist/esm/node_modules/prop-types/index.js.map +1 -1
  1285. package/dist/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -1
  1286. package/dist/esm/node_modules/prop-types/lib/has.js.map +1 -1
  1287. package/dist/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -1
  1288. package/dist/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -1
  1289. package/dist/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -1
  1290. package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  1291. package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js.map +1 -1
  1292. package/dist/esm/node_modules/react-hook-form/dist/index.esm.js +1 -1
  1293. package/dist/esm/node_modules/react-hook-form/dist/index.esm.js.map +1 -1
  1294. package/dist/esm/node_modules/react-is/cjs/react-is.development.js +11 -0
  1295. package/dist/esm/node_modules/react-is/cjs/react-is.development.js.map +1 -0
  1296. package/dist/esm/node_modules/react-is/cjs/react-is.production.js +11 -0
  1297. package/dist/esm/node_modules/react-is/cjs/react-is.production.js.map +1 -0
  1298. package/dist/esm/node_modules/react-is/index.js +2 -0
  1299. package/dist/esm/node_modules/react-is/index.js.map +1 -0
  1300. package/dist/esm/node_modules/react-leaflet/lib/hooks.js.map +1 -1
  1301. package/dist/esm/node_modules/react-transition-group/esm/Transition.js +1 -1
  1302. package/dist/esm/node_modules/react-transition-group/esm/Transition.js.map +1 -1
  1303. package/dist/esm/node_modules/react-transition-group/esm/TransitionGroup.js +1 -1
  1304. package/dist/esm/node_modules/react-transition-group/esm/TransitionGroup.js.map +1 -1
  1305. package/dist/esm/node_modules/react-transition-group/esm/TransitionGroupContext.js.map +1 -1
  1306. package/dist/esm/node_modules/react-transition-group/esm/config.js.map +1 -1
  1307. package/dist/esm/node_modules/react-transition-group/esm/utils/ChildMapping.js +1 -1
  1308. package/dist/esm/node_modules/react-transition-group/esm/utils/ChildMapping.js.map +1 -1
  1309. package/dist/esm/node_modules/react-transition-group/esm/utils/PropTypes.js +1 -1
  1310. package/dist/esm/node_modules/react-transition-group/esm/utils/PropTypes.js.map +1 -1
  1311. package/dist/esm/node_modules/react-transition-group/esm/utils/reflow.js.map +1 -1
  1312. package/dist/esm/node_modules/stylis/src/Enum.js.map +1 -1
  1313. package/dist/esm/node_modules/stylis/src/Middleware.js.map +1 -1
  1314. package/dist/esm/node_modules/stylis/src/Parser.js +1 -1
  1315. package/dist/esm/node_modules/stylis/src/Parser.js.map +1 -1
  1316. package/dist/esm/node_modules/stylis/src/Serializer.js.map +1 -1
  1317. package/dist/esm/node_modules/stylis/src/Tokenizer.js +1 -1
  1318. package/dist/esm/node_modules/stylis/src/Tokenizer.js.map +1 -1
  1319. package/dist/esm/node_modules/stylis/src/Utility.js.map +1 -1
  1320. package/dist/esm/node_modules/tangram/dist/tangram.min.js +1 -1
  1321. package/dist/esm/node_modules/tangram/dist/tangram.min.js.map +1 -1
  1322. package/dist/esm/scene.yaml.js +2 -0
  1323. package/dist/esm/scene.yaml.js.map +1 -0
  1324. package/dist/esm/services/api/api.service.js +1 -1
  1325. package/dist/esm/services/api/api.service.js.map +1 -1
  1326. package/dist/esm/types/components/checkbox/checkbox.stories.d.ts.map +1 -1
  1327. package/dist/esm/types/components/layers/leaflet/hooks/useGetLeafletLayer.d.ts.map +1 -1
  1328. package/dist/esm/types/components/layers/leaflet/leaflet.d.ts.map +1 -1
  1329. package/dist/esm/types/components/layers/leaflet/leaflet.stories.d.ts.map +1 -1
  1330. package/dist/esm/types/components/select/select.stories.d.ts.map +1 -1
  1331. package/dist/esm/types/configs/global/global.d.ts +6 -3
  1332. package/dist/esm/types/configs/global/global.d.ts.map +1 -1
  1333. package/dist/esm/types/configs/global/types.d.ts +5 -0
  1334. package/dist/esm/types/configs/global/types.d.ts.map +1 -0
  1335. package/package.json +37 -36
@@ -1,2 +1,2 @@
1
- var e,t,i={};function r(r,n){if(e)if(t){var s="var shared_chunk = {}; ("+e+")(shared_chunk); ("+t+")(shared_chunk);",o={};e(o),(i=n(o)).workerURL=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))}else t=n;else e=n}r(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function r(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}function n(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var s,o="v0.22.0",a=s={},l=0,u={};function h(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var i=s.targets;for(let e=0;e<t.length;e++){if(!i[t[e]])return[];i=i[t[e]]}return[e,i]}function c(e,t=null,i=null,r=[]){if(!e)return r;if(Array.isArray(e))e.forEach((t,i)=>c(t,e,i,r));else if("object"==typeof e)if(e instanceof ArrayBuffer)r.push({object:e,parent:t,property:i});else if(e.buffer instanceof ArrayBuffer)r.push({object:e.buffer,parent:t,property:i});else for(let t in e)c(e[t],e,t,r);return r}function d(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}s.targets={},s.addTarget=function(e,t){s.targets[e]=t},s.removeTarget=function(e){e&&delete s.targets[e]},s.withTransferables=function(...e){if(!(this instanceof s.withTransferables))return new s.withTransferables(...e);this.value=e,this.transferables=c(this.value)},t.is_main&&(s.postMessage=function(e,t,...i){if(Array.isArray(e))return Promise.all(e.map(e=>s.postMessage(e,t,...i)));let r={};"object"==typeof t&&(r=t,t=t.method);var n=new Promise((e,r)=>{u[l]={method:t,message:i,resolve:e,reject:r}});let o,a=[];return i&&1===i.length&&i[0]instanceof s.withTransferables&&(a=i[0].transferables,i=i[0].value),o={type:"main_send",message_id:l,method:t,message:i},r.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map(e=>e.object)),d(a),a.length>0&&m("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,n},s.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let i="string"==typeof t.data?JSON.parse(t.data):t.data,r=i.message_id;if("worker_reply"===i.type)u[r]&&(i.error?u[r].reject(i.error):u[r].resolve(i.message),delete u[r]);else if("worker_send"===i.type&&null!=r){let t,n,o,a,l;try{if([a,o]=h(i.method),!o)throw Error(`Worker broker could not dispatch message type ${i.method} on target ${i.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${i.method} on target ${i.target} because object has no method with that name`);t=l.apply(o,i.message)}catch(e){n=e}let u,c=[];t instanceof Promise?t.then(t=>{t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t},e.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:r,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t,error:n instanceof Error?`${n.message}: ${n.stack}`:n},e.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`))}})},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let i={};"object"==typeof e&&(i=e,e=e.method);var r=new Promise((i,r)=>{u[l]={method:e,message:t,resolve:i,reject:r}});let n,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),n={type:"worker_send",message_id:l,method:e,message:t},i.stringify&&(n=JSON.stringify(n)),self.postMessage(n,o.map(e=>e.object)),d(o),o.length>0&&m("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,r},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,i=t.message_id;if("main_reply"===t.type)u[i]&&(t.error?u[i].reject(t.error):u[i].resolve(t.message),delete u[i]);else if("main_send"===t.type&&null!=i){let r,n,o,a,l;try{if([a,o]=h(t.method),!o)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);r=l.apply(o,t.message)}catch(e){n=e}let u,c=[];r instanceof Promise?r.then(e=>{e instanceof s.withTransferables&&(c=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:i,message:e},self.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:i,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(r instanceof s.withTransferables&&(c=r.transferables,r=r.value[0]),u={type:"worker_reply",message_id:i,message:r,error:n instanceof Error?`${n.message}: ${n.stack}`:n},self.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to main thread`))}}));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},p={};let _={};function m(e,...i){let r="object"==typeof e?e.level:e;if(f[r]<=f[m.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...i);{if("object"==typeof e&&!0===e.once){if(_[JSON.stringify(i)])return Promise.resolve(!1);_[JSON.stringify(i)]=!0}let n=function(e){if(t.is_main)return p[e]=p[e]||(console[e]?console[e]:console.log).bind(console),p[e]}(r);i.length>1?n(`Tangram ${o} [${r}]: ${i[0]}`,...i.slice(1)):n(`Tangram ${o} [${r}]: ${i[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}m.level="info",m.workers=null,m.setLevel=function(e){m.level=e,t.is_main&&Array.isArray(m.workers)&&a.postMessage(m.workers,"_logSetLevelProxy",e)},t.is_main&&(m.setWorkers=function(e){m.workers=e},m.reset=function(){_={}}),a.addTarget("_logProxy",m),a.addTarget("_logSetLevelProxy",m.setLevel);const g={};let y;a.addTarget("Utils",g),g.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},g._requests={},g._proxy_requests={},g.io=function(e,i=6e4,r="text",n="GET",s={},o=null,l=!1){if(t.is_worker&&g.isMicrosoft())return m("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=!0),a.postMessage("Utils.io",e,i,r,n,s,o,!0);var u=new XMLHttpRequest,h=new Promise((t,o)=>{if(u.open(n,e,!0),u.timeout=i,u.responseType=r,s&&"object"==typeof s)for(let e in s)u.setRequestHeader(e,s[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):o(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{o(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{o(Error("timeout "+e.toString()))},u.send()});return h=h.then(e=>(o&&delete g._requests[o],l?a.withTransferables(e):e)),o&&(g._requests[o]=u),h},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(m("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):m("trace",`Could not find network request key '${e}'`)},g.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},g.use_high_density_display=!0,g.updateDevicePixelRatio=function(){let e=g.device_pixel_ratio;return g.device_pixel_ratio=g.use_high_density_display&&window.devicePixelRatio||1,g.device_pixel_ratio!==e},t.is_main&&g.updateDevicePixelRatio(),g.isPowerOf2=function(e){return!(e&e-1)},g.interpolate=function(e,t,i){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,n,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof i&&(o=i(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof i&&(o=i(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],n=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof i?(a=i(t[l][1][u]),s=i(t[l+1][1][u])-a,o[u]=s*(e-r)/(n-r)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-r)/(n-r)+t[l][1][u])}else"function"==typeof i?(a=i(t[l][1]),o=(s=i(t[l+1][1])-a)*(e-r)/(n-r)+a):o=(s=t[l+1][1]-t[l][1])*(e-r)/(n-r)+t[l][1];break}return o},g.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var b=y={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function v(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let i=e.indexOf("#");return i>-1&&(e=e.substr(0,i)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function A(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}const T={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=T.id++,e.max_time=e.max_time||T.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,i)=>{e.resolve=t,e.reject=i});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<T.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=T.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<T.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function k(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let i=t.indexOf(e);i>-1&&t.splice(i,1)},unsubscribeAll(){t=[]},trigger(e,...i){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...i)}catch(t){m("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let i=!1;return t.forEach(t=>{"function"==typeof t[e]&&(i=!0)}),i}})}function E(e,t){let i={};return t.forEach(t=>i[t]=e[t]),i}class S{constructor(e,t,i={}){i=S.sliceOptions(i),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=i.filtering,this.density=i.density||1,this.sprites=i.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,S.textures[this.name]&&(this.retain_count=S.textures[this.name].retain_count,S.textures[this.name].retain_count=0,S.textures[this.name].destroy()),S.textures[this.name]=this,S.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},i)),this.load(i),m("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?m("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,S.textures[this.name]===this&&(delete S.textures[this.name],delete S.texture_configs[this.name]),this.valid=!1,m("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&m("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(S.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),S.activeUnit=e,S.boundTexture=null),S.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),S.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let i=new Image;i.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=i.width,e.height=i.height,r.drawImage(i,0,0),this.setElement(e,t)}else this.setElement(i,t)}catch(e){this.loaded=!1,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},i.onerror=i=>{this.loaded=!1,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,i,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:i,texture:t}),e(this)},g.isSafari()&&"data:"===this.url.slice(0,5)||(i.crossOrigin="anonymous"),i.src=this.url}),this.loading}setData(e,t,i,r={}){return this.width=e,this.height=t,Array.isArray(i)&&(i=new Uint8Array(i)),this.update(i,r),this.setFiltering(r),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let i=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(i)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",m("warn",`Texture '${this.name}': ${e}`,t),S.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),S.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),g.isPowerOf2(this.width)&&g.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),S.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=S.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}S.create=function(e,t,i){return new S(e,t,i)},S.retain=function(e){S.textures[e]&&S.textures[e].retain()},S.release=function(e){S.textures[e]&&S.textures[e].release()},S.destroy=function(e){Object.keys(S.textures).forEach(t=>{var i=S.textures[t];i.gl===e&&i.destroy({force:!0})})},S.getSpriteInfo=function(e,t){let i=S.textures[e];return i&&{size:i.sizes[t],css_size:i.css_sizes[t],aspect:i.aspects[t],texcoords:i.texcoords[t]}},S.getTexcoordsForSprite=function(e,t,i){var r=i[1]-e[1]-t[1];return[e[0]/i[0],r/i[1],(t[0]+e[0])/i[0],(t[1]+r)/i[1]]},S.createFromObject=function(e,t){let i=[];if(t)for(let r in t){let n=t[r];if(n.skip_create)continue;if(!S.changed(r,n))continue;let s=S.create(e,r,n);i.push(s.loading)}return Promise.all(i)},S.default="__default",S.createDefault=function(e){return S.create(e,S.default)},S.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},S.changed=function(e,t){let i=S.textures[e];if(i){if("element"===i.config_type||null!=t.element)return!0;if(t=S.sliceOptions(t),S.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},S.getInfo=function(e){if(e||(e=Object.keys(S.textures)),Array.isArray(e))return Promise.all(e.map(e=>S.getInfo(e)));var t=S.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},S.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>S.textures[e.name]=e),S.textures))},S.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},S.textures={},S.texture_configs={},S.boundTexture=null,S.activeUnit=null,a.addTarget("Texture",S),k(S);var R={parseUniforms:function(e={}){var t=[];for(const[i,r]of Object.entries(e))if("number"==typeof r)t.push({type:"float",method:"1f",name:i,value:r,path:[i]});else if(Array.isArray(r)){if("number"==typeof r[0])r.length>=2&&r.length<=4?t.push({type:"vec"+r.length,method:r.length+"fv",name:i,value:r,path:[i]}):r.length>4&&t.push({type:"float[]",method:"1fv",name:i+"[0]",value:r,path:[i]});else if("string"==typeof r[0])for(let e=0;e<r.length;e++)t.push({type:"sampler2D",method:"1i",name:i+"["+e+"]",value:r[e],path:[i,e]});else if(Array.isArray(r[0])&&"number"==typeof r[0][0]&&r[0].length>=2&&r[0].length<=4)for(let e=0;e<r.length;e++)t.push({type:"vec"+r[0].length,method:r[0].length+"fv",name:i+"["+e+"]",value:r[e],path:[i,e]})}else"boolean"==typeof r?t.push({type:"bool",method:"1i",name:i,value:r,path:[i]}):"string"==typeof r&&t.push({type:"sampler2D",method:"1i",name:i,value:r,path:[i]});return t},defineVariable:function(e,t){var i,r;if("number"==typeof t)i="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?i="vec"+t.length:(i="float",r=t.length):"string"==typeof t[0]?(i="sampler2D",r=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(i="vec"+t[0].length,r=t.length);else if("boolean"==typeof t)i="bool";else{if("string"!=typeof t)return;i="sampler2D"}var n="";return n+=`${i} ${e}`,r&&(n+=`[${r}]`),n+";\n"},defineUniform:function(e,t){var i=R.defineVariable(e,t);if(i)return"uniform "+i},expandVec3:function(e,t=1){let i;if(Array.isArray(e)){if(2!==e.length)return e;i=[...e,t].map(parseFloat)}else i=[e,e,e].map(parseFloat);if(i&&i.every(e=>"number"==typeof e&&!isNaN(e)))return i},expandVec4:function(e,t=1){let i;if(Array.isArray(e)){if(3!==e.length)return e;i=[...e,t].map(parseFloat)}else i=[e,e,e,t].map(parseFloat);if(i&&i.every(e=>"number"==typeof e&&!isNaN(e)))return i}};let z=[];function M(e,t){let i=z.filter(t=>t[0]===e)[0];return i=i&&i[1],i||(z.push([e,{}]),i=z[z.length-1][1]),i[t]||(i[t]=e.getExtension(t)),i[t]}function P(e){var t,i,r=0;if(0===e.length)return r;for(t=0,i=e.length;t<i;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var N,C,L=(C||(C=1,N=function(e){e=String(e);for(var t,i=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(o=t[1].trim()).split(":"),n=r.slice(2).join(":").trim(),s=parseInt(r[0],10),o=parseInt(r[1],10);i.push({message:n,file:s,line:o})}return i}),N),I=O(L);const F=/^\s*#pragma.*$/gm,D=/\\\s*\n/gm;class U{constructor(e,t,i,r){r=r||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=i,this.id=U.id++,this.name=r.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(U.current!==this&&this.gl.useProgram(this.program),U.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,i=this.buildDefineList(),r=this.buildShaderBlockList();for(var n in r){var s=r[n];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+n+"\\s*$","m");var o=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=o||null!=a){var l="";s.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=o&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),i["TANGRAM_BLOCK_"+n.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",h=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=h&&h.precision>0?"precision highp float;\n":"precision mediump float;\n",i.TANGRAM_VERTEX_SHADER=!0,i.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+U.buildDefineString(i)+this.computed_vertex_source,i.TANGRAM_VERTEX_SHADER=!1,i.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=U.buildExtensionString(e)+u+U.buildDefineString(i)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(D,""),this.computed_fragment_source=this.computed_fragment_source.replace(D,"");try{this.program=U.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in U.defines)t[e]=U.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in U.blocks)t[e]=[],Array.isArray(U.blocks[e])?t[e].push(...U.blocks[e].map((t,i)=>({key:e,source:t,num:i,scope:"ShaderProgram"}))):t[e]=[{key:e,source:U.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let i=this.block_scopes&&this.block_scopes[e]||[],r=null,n=0;for(let s=0;s<this.blocks[e].length;s++)i[s]!==r&&(r=i[s],n=0),t[e].push({key:e,source:this.blocks[e][s],num:n,scope:r||this.name}),n++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>R.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),R.parseUniforms(e).forEach(({name:e,type:t,value:i,method:r})=>{"sampler2D"===t?this.setTextureUniform(e,i):this.uniform(r,e,i)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var i=S.textures[t];null!=i?(i.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):m("warn",`Cannot find texture '${t}'`)}uniform(e,t,i){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=i,this.updateUniform(r)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,i=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,i);break;case"1f":this.gl.uniform1f(t,i);break;case"2f":this.gl.uniform2f(t,i[0],i[1]);break;case"3f":this.gl.uniform3f(t,i[0],i[1],i[2]);break;case"4f":this.gl.uniform4f(t,i[0],i[1],i[2],i[3]);break;case"1iv":this.gl.uniform1iv(t,i);break;case"3iv":this.gl.uniform3iv(t,i);break;case"1fv":this.gl.uniform1fv(t,i);break;case"2fv":this.gl.uniform2fv(t,i);break;case"3fv":this.gl.uniform3fv(t,i);break;case"4fv":this.gl.uniform4fv(t,i);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,i);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,i)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let i=this.lines(e);if(i)return i[t]}block(e,t){let i,r=this.lines(e);for(let e=0;e<t&&e<r.length;e++){let t=r[e],n=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);n&&n.length>1?i={scope:n[1],name:n[2],num:n[3]}:(n=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),n&&n.length>1&&(i=null)),i&&(i.line=null==i.line?-1:i.line+1,i.source=t)}return i}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let i=M(this.gl,t),r=`TANGRAM_EXTENSION_${t}`;this.defines[r]=null!=i,i?e.push(t):m("debug",`Could not enable extension '${t}'`)}),e}}U.id=0,U.current=null,U.defines={},U.blocks={},U.reset=function(){U.programs_by_source={},U.shaders_by_source={}},U.reset(),U.buildDefineString=function(e){var t="";for(var i in e)null!=e[i]&&!1!==e[i]&&("boolean"==typeof e[i]&&!0===e[i]?t+="#define "+i+"\n":"number"==typeof e[i]&&Math.floor(e[i])===e[i]?t+="#define "+i+" "+e[i].toFixed(1)+"\n":t+="#define "+i+" "+e[i]+"\n");return t},U.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},U.addBlock=function(e,...t){U.blocks[e]=U.blocks[e]||[],U.blocks[e].push(...t)},U.removeBlock=function(e){U.blocks[e]=[]},U.replaceBlock=function(e,...t){U.removeBlock(e),U.addBlock(e,...t)},U.updateProgram=function(e,t,i,r){let n=P(e._tangram_id+"::"+i+"::"+r);if(U.programs_by_source[n])return m("trace","Reusing identical source GL program object"),U.programs_by_source[n];var s=U.createShader(e,i,e.VERTEX_SHADER),o=U.createShader(e,r,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==s||null==o)return t;if(e.attachShader(t,s),e.attachShader(t,o),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let n=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${i}\n --- Fragment Shader ---\n ${r}`);throw Object.assign(new Error(n),{type:"program"})}return U.programs_by_source[n]=t,t},U.createShader=function(e,t,i){let r=P(e._tangram_id+"::"+t);if(U.shaders_by_source[r])return m("trace","Reusing identical source GL shader object"),U.shaders_by_source[r];let n=e.createShader(i);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let t=i===e.VERTEX_SHADER?"vertex":"fragment",r=e.getShaderInfoLog(n),s=I(r);throw Object.assign(new Error(r),{type:t,errors:s})}return U.shaders_by_source[r]=n,n};var j,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=M(e,"OES_vertex_array_object")),null!=t?m("info","Vertex Array Object extension available"):!0!==this.disabled?m("warn","Vertex Array Object extension NOT available"):m("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return M(e,t)},create(e,t,i){let r={};r.setup=t,r.teardown=i;let n=this.getExtension(e,"OES_vertex_array_object");return null!=n&&(r._vao=n.createVertexArrayOES(),n.bindVertexArrayOES(r._vao)),r.setup(),r},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let i=this.bound_vao,r=i.filter(t=>t[0]===e)[0];null==r?i.push([e,t]):r[1]=t},bind(e,t){let i=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=i&&null!=t._vao?(i.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=i?i.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let i=this.getExtension(e,"OES_vertex_array_object");null!=i&&null!=t&&null!=t._vao&&(i.deleteVertexArrayOES(t._vao),t._vao=null)}};function G(e,...t){for(let i=0;i<t.length;i++){let r=t[i];if(r)for(let t in r){let i=r[t];null===i||"object"!=typeof i||Array.isArray(i)?void 0!==i&&(e[t]=i):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=G({},i):e[t]=G(e[t],i)}}return e}var V=j={};j.default_source_max_zoom=18,j.default_view_max_zoom=20,j.max_style_zoom=25,j.tile_size=256,j.half_circumference_meters=20037508.342789244,j.circumference_meters=2*j.half_circumference_meters,j.min_zoom_meters_per_pixel=j.circumference_meters/j.tile_size;let $=[];j.metersPerPixel=function(e){return $[e]=$[e]||j.min_zoom_meters_per_pixel/Math.pow(2,e),$[e]};let q=[];j.metersPerTile=function(e){return q[e]=q[e]||j.circumference_meters/Math.pow(2,e),q[e]},j.tile_scale=4096,j.units_per_pixel=j.tile_scale/j.tile_size,j.height_scale=16;let W=[];j.unitsPerMeter=function(e){return W[e]=W[e]||j.tile_scale/(j.tile_size*j.metersPerPixel(e)),W[e]},j.metersForTile=function(e){return{x:e.x*j.circumference_meters/Math.pow(2,e.z)-j.half_circumference_meters,y:-(e.y*j.circumference_meters/Math.pow(2,e.z)-j.half_circumference_meters)}},j.tileForMeters=function([e,t],i){return{x:Math.floor((e+j.half_circumference_meters)/(j.circumference_meters/Math.pow(2,i))),y:Math.floor((-t+j.half_circumference_meters)/(j.circumference_meters/Math.pow(2,i))),z:i}},j.wrapTile=function({x:e,y:t,z:i},r={x:!0,y:!1}){var n=(1<<i)-1;return r.x&&(e&=n),r.y&&(t&=n),{x:e,y:t,z:i}},j.metersToLatLng=function(e){return e[0]/=j.half_circumference_meters,e[1]/=j.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},j.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=j.half_circumference_meters,e[0]*=j.half_circumference_meters/180,e},j.tileSpaceToLatlng=function(e,t,i){const r=j.unitsPerMeter(t);return j.transformGeometry(e,e=>{e[0]=e[0]/r+i.x,e[1]=e[1]/r+i.y,j.metersToLatLng(e)}),e},j.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},j.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},j.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},j.findBoundingBox=function(e){for(var t=1/0,i=-1/0,r=1/0,n=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<r&&(r=a[1]),a[0]>i&&(i=a[0]),a[1]>n&&(n=a[1])}return[t,r,i,n]},j.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},j.centroid=function(e,t=!0){if(!e||0===e.length)return;let i,r=0,n=0,s=0,o=e[0],a=o.length;t&&(i=o[0],o=o.map(e=>[e[0]-i[0],e[1]-i[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let i=o[e],a=o[t],l=i[1]*a[0]-a[1]*i[0];r+=(i[0]+a[0])*l,n+=(i[1]+a[1])*l,s+=3*l}if(!s)return;let l=[r/s,n/s];return t&&(l[0]+=i[0],l[1]+=i[1]),l},j.multiCentroid=function(e){let t=0,i=null;for(let r=0;r<e.length;r++){let n=j.centroid(e[r]);n&&(i=i||[0,0],i[0]+=n[0],i[1]+=n[1],t++)}return t>0&&(i[0]/=t,i[1]/=t),i},j.signedPolygonRingAreaSum=function(e){let t=0,i=e.length;for(let r=0;r<i-1;r++){let i=e[r],n=e[r+1];t+=i[0]*n[1]-n[0]*i[1]}return t+=e[i-1][0]*e[0][1]-e[0][0]*e[i-1][1],t},j.polygonRingArea=function(e){return Math.abs(j.signedPolygonRingAreaSum(e))/2},j.polygonArea=function(e){if(e)return j.polygonRingArea(e[0])},j.multiPolygonArea=function(e){let t=0;for(let i=0;i<e.length;i++)t+=j.polygonArea(e[i]);return t},j.ringWinding=function(e){let t=j.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const Z={functions:{},num_functions:0,num_cached:0};function H(e,t){if("string"==typeof e)e=X(e,t);else if(null!=e&&"object"==typeof e)for(let i in e)e[i]=H(e[i],t);return e}function X(e,t){let i="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(i&&i.length>2)try{const e=i[2],r="function"==typeof t?t(e):e,n=P(r);if(void 0===Z.functions[n]){let t=i[1].length>0&&i[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],Z.functions[n]=new Function(t.toString(),r),Z.functions[n].source=e,Z.num_functions++}else Z.num_cached++;return Z.functions[n]}catch(t){return e}return e}var Y,J={},K=O(function(){if(Y)return J;Y=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return e<0?0:e>1?1:e}function r(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function n(e){return"%"===e[e.length-1]?i(parseFloat(e)/100):i(parseFloat(e))}function s(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{J.parseCSSColor=function(i){var o,a=i.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var h=a.substr(0,l),c=a.substr(l+1,u-(l+1)).split(","),d=1;switch(h){case"rgba":if(4!==c.length)return null;d=n(c.pop());case"rgb":return 3!==c.length?null:[r(c[0]),r(c[1]),r(c[2]),d];case"hsla":if(4!==c.length)return null;d=n(c.pop());case"hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,p=n(c[1]),_=n(c[2]),m=_<=.5?_*(p+1):_+p-_*p,g=2*_-m;return[t(255*s(g,m,f+1/3)),t(255*s(g,m,f)),t(255*s(g,m,f-1/3)),d];default:return null}}return null}}catch(e){}return J}());const Q={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ie=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),re=e=>Array.isArray(e)?e.map(ie).map(ee):ee(ie(e));Object.assign(Q,{clampPositive:ee,noNaN:te,parseNumber:ie,parsePositiveNumber:re}),Q.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},Q.zeroPair=Object.freeze([0,0]),Q.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},Q.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},Q.getFeatureParseContext=function(e,t,i){return{feature:e,id:e.id,tile:t,global:i,zoom:t.style_z,geometry:V.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ne={STATIC:0,DYNAMIC:1,ZOOM:2};Q.CACHE_TYPE=ne,Q.createPropertyCache=function(e,t=null,i=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let r={value:e,type:ne.STATIC};return Array.isArray(r.value)&&Array.isArray(r.value[0])?(r.zoom={},r.type=ne.ZOOM):"function"==typeof r.value&&(r.type=ne.DYNAMIC,r.dynamic_transform="function"==typeof i?i:null),"function"==typeof t&&(r.zoom?r.value=r.value.map((e,i)=>[e[0],t(e[1],i)]):"function"!=typeof r.value&&(r.value=t(r.value,0))),r},Q.createColorPropertyCache=function(e){return Q.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?X(Q.wrapFunction(Q.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?Q.macros["Style.color.randomColor"]:e)};const se=e=>"string"==typeof e&&"%"===e[e.length-1],oe=e=>"auto"===e,ae=e=>se(e)||oe(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return Q.createPropertyCache(e.value,(i,r)=>(Array.isArray(i)?(i=i.map((t,i)=>e.has_ratio[r][i]?t:re(t)).map((i,n)=>e.has_pct[r][n]?t.css_size[n]*i/100:i),e.has_ratio[r][0]?i[0]=i[1]*t.aspect:e.has_ratio[r][1]&&(i[1]=i[0]/t.aspect)):(i=re(i),i=e.has_pct[r]?t.css_size.map(e=>e*i/100):[i,i]),i))}function he(e,t){try{return e(t)}catch(i){m("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${i.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}Q.createPointSizePropertyCache=function(e,t){let i=null,r=null;if(se(e))i=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):se(e[1]))&&(i=e.map(e=>Array.isArray(e[1])?e[1].map(e=>se(e)):se(e[1])),r=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>oe(e))),r.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(i=[e.map(se)],r=[e.map(oe)],r[0].every(e=>e)))throw le}else if(oe(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(i||r){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=i,e.has_ratio=r,e.sprites={}}else e=Q.createPropertyCache(e,re);return e},Q.evalCachedPointSizeProperty=function(e,t,i,r){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),Q.evalCachedProperty(e.sprites[t.sprite],r)):(e.texture=e.texture||ue(e,i),Q.evalCachedProperty(e.texture,r)):Q.evalCachedProperty(e,r)},Q.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?he(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,he(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},Q.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*V.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ie(e),e*=V.metersPerPixel(t.zoom)):e=ie(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],Q.convertUnits(e[1],t)]):e.map(e=>Q.convertUnits(e,t));return e},Q.parseUnits=function(e){var t={value:ie(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},Q.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?he(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,he(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,e=>Q.convertUnits(e,t)),e.zoom[t.zoom]):Q.convertUnits(e.value,t)},Q.string_colors={},Q.colorForString=function(e){if(Q.string_colors[e])return Q.string_colors[e];let t=K.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=Q.defaults.color,Q.string_colors[e]=t,t},Q.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let i=he(e.dynamic,t);return"string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let i=he(e.dynamic,t);return"string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if("string"==typeof e.value)return e.static=Q.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let i=e.value[t];i&&"string"==typeof i[1]&&(i[1]=Q.colorForString(i[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},Q.evalCachedColorPropertyWithAlpha=function(e,t,i){const r=Q.evalCachedColorProperty(e,i);if(null!=r&&null!=t){const e=Q.evalCachedProperty(t,i);if(null!=e)return[r[0],r[1],r[2],e]}return r},Q.parseColor=function(e,t={}){if("function"==typeof e&&(e=he(e,t)),"string"==typeof e)e=Q.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i[1]&&(i[1]=Q.colorForString(i[1]))}t.zoom&&(e=g.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},Q.calculateOrder=function(e,t){return"function"==typeof e?e=he(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:re(e)),e},Q.evalProperty=function(e,t){return"function"==typeof e?he(e,t):e};class ce{constructor(e,t,i){this.gl=e,this.workers=t,this._lock_fn="function"==typeof i&&i,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=S.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...ce.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((i,r)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:i,reject:r}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var i=this.requests[t];if(i.sent)continue;let r,n,s=255,{point:o,radius:l}=i;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);n={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},n={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<n.x*n.y*4)&&(this.pixels=new Uint8Array(n.x*n.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((o.x-l.x)*this.fbo_size.width),Math.round((1-o.y-l.y)*this.fbo_size.height),n.x,n.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(n.y/2)*n.x+Math.round(n.x/2)),h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(h>0)r=h+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<n.y;t++)for(let i=0;i<n.x;i++,u+=4)if(h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),h>0){let o=(i-n.x/2)*(i-n.x/2)+(t-n.y/2)*(t-n.y/2);o<=e&&(r=h+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3],e=o)}}255!==s?null!=this.workers[s]&&a.postMessage(this.workers[s],"self.getFeatureSelection",{id:i.id,key:r}).then(e=>{this.finishRead(e)}):this.finishRead({id:i.id}),i.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var i=e.feature,r=!1;(null!=i&&null==this.feature||null==i&&null!=this.feature||null!=i&&null!=this.feature&&JSON.stringify(i)!==JSON.stringify(this.feature))&&(r=!0),this.feature=i,t.resolve({feature:i,changed:r,request:t}),delete this.requests[e.id]}else m("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,i=this.map_entry>>8&255,r=this.map_entry>>16&255,n=this.map_prefix,s=t/255,o=i/255,a=r/255,l=n/255,u=t+(i<<8)+(r<<16)+(n<<24)>>>0;return this.map[u]={color:[s,o,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,i){var r=this.makeEntry(t);return r.feature={id:e.id,properties:e.properties,source_name:i.source,source_layer:i.layer,layers:i.layers,tile:this.tiles[t.key].tile},r.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var de;ce.map={},ce.tiles={},ce.map_size=0,ce.map_entry=0,ce.map_prefix=0,ce.defaultColor=[0,0,0,1];var fe=de={};de.BYTE=5120,de.UNSIGNED_BYTE=5121,de.SHORT=5122,de.UNSIGNED_SHORT=5123,de.INT=5124,de.UNSIGNED_INT=5125,de.FLOAT=5126;class pe{constructor(e,t,i,r,n){n=n||{},this.gl=e,this.vertex_data=t,this.element_data=i,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=n.draw_mode||this.gl.TRIANGLES,this.data_usage=n.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=n.uniforms,this.textures=n.textures,this.retain=n.retain||!1,this.created_at=+new Date,this.fade_in_time=n.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||U.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let i=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",i),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),i<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>S.release(e)),!0}}const _e=["emission","ambient","diffuse","specular"];class me{constructor(e){e=e||{},_e.forEach(t=>{const i=e[t];null!=i&&(i.texture?this[t]={texture:i.texture,mapping:i.mapping||"spheremap",scale:R.expandVec3(null!=i.scale?i.scale:1),amount:R.expandVec4(null!=i.amount?i.amount:1)}:"number"==typeof i||Array.isArray(i)?this[t]={amount:R.expandVec4(i)}:this[t]="string"==typeof i?{amount:Q.parseColor(i)}:i)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:R.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){_e.forEach(t=>{let i=`TANGRAM_MATERIAL_${t.toUpperCase()}`,r=i+"_TEXTURE";e.defines[i]=null!=this[t],this[t]&&this[t].texture&&(e.defines[r]=!0,e.defines[r+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(me.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){_e.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ge;me.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=e[r];return t},ge.neg=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=-e[r];return t},ge.add=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]+t[n];return i},ge.sub=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]-t[n];return i},ge.signed_area=function(e,t,i){return(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var i,r=[],n=e.length;if("number"==typeof t)for(i=0;i<n;i++)r[i]=e[i]*t;else for(n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]*t[i];return r},ge.div=function(e,t){var i,r=[];if("number"==typeof t)for(i=0;i<e.length;i++)r[i]=e[i]/t;else{var n=Math.min(e.length,t.length);for(i=0;i<n;i++)r[i]=e[i]/t[i]}return r},ge.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var i=Math.cos(t),r=Math.sin(t);return[e[0]*i-e[1]*r,e[0]*r+e[1]*i]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var i=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return i>1&&(i=1),Math.acos(i)},ge.isEqual=function(e,t){for(var i=e.length,r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0},ge.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ge.length=function(e){return Math.sqrt(ge.lengthSq(e))},ge.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ge.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ge.dot=function(e,t){for(var i=0,r=Math.min(e.length,t.length),n=0;n<r;n++)i+=e[n]*t[n];return i};class be{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=R.expandVec3(t.ambient||0):this.ambient=Q.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=R.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Q.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=R.expandVec3(t.specular||0):this.specular=Q.parseColor(t.specular).slice(0,3)}static create(e,t){if(be.types[t.type])return new be.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=be.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(U.removeBlock(be.block),!be.enabled)return;let t="";if(e&&Object.keys(e).length>0){let i={};for(let t in e)i[e[t].type]=!0;for(let e in i)be.types[e].inject();for(let i in e)e[i].inject(),t+=`calculateLight(${i}, _eyeToPoint, _normal);\n`}let i=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;U.addBlock(be.block,i)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;U.addBlock(be.block,e),U.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}be.types={},be.block="lighting",be.enabled=!0,be.types.ambient=class extends be{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},be.types.directional=class extends be{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,i=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*i,Math.sin(Math.PI*e/180)*i,-.5],null==t.ambient&&(this.ambient=R.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class ve extends be{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,U.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],U.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=V.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=Q.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=Q.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,Q.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)})),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,Q.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}))}}be.types.point=ve,be.types.spotlight=class extends ve{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(m({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const i=we.types[e.type](e);if(i)return new i(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const i=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],r=E(e.config,i),n=E(t.config,i);return JSON.stringify(r)!==JSON.stringify(n)}static projectData(e){var t=+new Date;for(var i in e.layers)for(var r=e.layers[i].features.length,n=0;n<r;n++){var s=e.layers[i].features[n];V.transformGeometry(s.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){V.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:i}){let r=V.unitsPerMeter(t);for(var n in e.layers)for(var s=e.layers[n].features.length,o=0;o<s;o++){var a=e.layers[n].features[o];V.transformGeometry(a.geometry,e=>{e[0]=(e[0]-i.x)*r,e[1]=(e[1]-i.y)*r*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let i=e.source_data.layers[t];i&&i.features&&i.features.forEach(e=>{V.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-V.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-V.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return m("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:V.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!g.isPowerOf2(this.tile_size))&&(m({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=V.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=V.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const i=this.rasters[t];if(this.sources[i]&&this.sources[i]!==this&&!this.sources[i].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ae=0;class Te extends we{constructor(e,t){super(e,t),this.response_type="";let[i,r]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var i=e.indexOf("?"),r=e.indexOf("#"),n="";r>-1&&(n=e.slice(r),e=e.slice(0,r)),-1===i&&(i=e.length,e+="?"),i++;var s="",o=[];for(var a in t)""===A(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return[e=e.slice(0,i)+s+e.slice(i)+n,o]}(e.url,e.url_params);this.url=i,r.forEach(([t,i])=>{m({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${i}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),i=e.source_data;return i.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(r=>{let n=Ae+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,n);i.request_id=n,i.error=null,s.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,i,t):i.layers={},e.debug.parsing=+new Date-e.debug.parsing,r(e)})}).catch(t=>{i.error=t.stack,r(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class ke extends Te{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):m({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,i,r,n]=e.bounds;return{latlng:[...e.bounds],meters:{min:V.latLngToMeters([t,n]),max:V.latLngToMeters([r,i])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=V.wrapTile(e);let i=t.tiles.min[e.z];i||(i=t.tiles.min[e.z]=V.tileForMeters(t.meters.min,e.z));let r=t.tiles.max[e.z];if(r||(r=t.tiles.max[e.z]=V.tileForMeters(t.meters.max,e.z)),e.y<i.y||e.y>r.y)return!1;if(i.x<=r.x){if(e.x<i.x||e.x>r.x)return!1}else if(e.x>r.x&&e.x<i.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let i=V.wrapTile(t.coords,{x:!0});this.tms&&(i.y=Math.pow(2,i.z)-1-i.y);let r=e.replace("{x}",i.x).replace("{y}",i.y).replace("{z}",i.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(i));return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}getDensityModifier(){if(this.url_density_scales){const e=g.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:i}){let r="";for(let n=i;n>0;n--){let i=0,s=1<<n-1;e&s&&i++,t&s&&(i+=2),r+=i.toString()}return r}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const Ee={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:i})=>e+"/"+t+"/"+i,key(e,t,i){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,i].join("/")},normalizedKey(e,t,i){return this.key(this.normalizedCoord(e,t),t,i)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:i},r){if(i!==(r=Math.max(0,r))){let n=Math.pow(2,i-r);e=Math.floor(e/n),t=Math.floor(t/n),i=r}return this.coord({x:e,y:t,z:i})},coordForTileZooms({x:e,y:t,z:i},r){const n=this.findZoomInRange(i,r);return n!==i?this.coordAtZoom({x:e,y:t,z:i},n):this.coord({x:e,y:t,z:i})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:i,y:r}=this.coordAtZoom(t,e.z);return e.x===i&&e.y===r}return!1},parent({coords:e,source:t,style_z:i}){if(i>0){i--;const r=Math.max(i-t.zoom_bias,t.zooms[0]),n=this.coordForTileZooms(this.coordAtZoom(e,r),t.zooms);return n.z>i?null:{key:this.key(n,t,i),coords:n,style_z:i,source:t}}},children({coords:e,source:t,style_z:i},r={}){i++;const n=this.coordForTileZooms(this.coordAtZoom(e,i-t.zoom_bias),t.zooms);if(n.z===e.z)return[{key:this.key(n,t,i),coords:n,style_z:i,source:t}];{const s=this.key(n,t,i);if(r[t.id]=r[t.id]||{},null==r[t.id][s]){const o=Math.pow(2,n.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let r=l;r<l+o;r++){let s=this.coord({x:e,y:r,z:n.z});u.push({key:this.key(s,t,i),coords:s,style_z:i,source:t})}r[t.id][s]=u}return r[t.id][s]}}};class Se extends ke{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=V.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),i=t.key;if(!this.textures[i]){let e=this.formatURL(this.url,{coords:t});this.textures[i]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[i]}adjustRasterTileZoom(e){let t=e.coords;const i=this.sources[e.source];if(i!==this){let r=this.zoom_bias-i.zoom_bias;r>0?t=Ee.normalizedCoord(e.coords,{zoom_bias:r,zooms:this.zooms}):(r<0&&m({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${i.name}' it's attached to. Downsampling this source ${-r} extra zoom levels to match.`),t=Ee.coordForTileZooms(t,this.zooms))}return t}}class Re extends Se{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:i}){let r=this.adjustRasterTileZoom(e);const n="opaque"!==t,s=`raster-${this.name}-${r.key}-${n?"alpha":"opaque"}-${i}`;if(S.textures[s])return{name:s,coords:r,skip_create:!0};let o=g.device_pixel_ratio;this.max_display_density&&(o=Math.min(o,this.max_display_density)),o*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*o,a.height=this.tile_size*o,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const i=n?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,i,e,o,l)})),{name:s,element:a,filtering:this.filtering,coords:r}}async drawImage(e,t,i,r,n,s){const o=P(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=V.metersPerPixel(r.coords.z)/n/(this.tile_size/V.tile_size),u=(t.meters.min[0]-r.min.x)/l,h=-(t.meters.min[1]-r.min.y)/l,c=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=i?i:1,s.drawImage(a,u,h,c,d)}loadImage(e){return new Promise(t=>{let i=new Image;i.onload=()=>t(i),i.onerror=i=>{m("warn",`Raster source '${this.name}': failed to load url: '${e}'`,i),t(null)},g.isSafari()&&"data:"===e.slice(0,5)||(i.crossOrigin="anonymous"),i.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let i="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(i+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(i);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(i)}}}function ze(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Me(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ze(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}we.register("Raster",e=>Se.urlHasTilePattern(e.url)?Se:Re);var Pe={init({generation:e,styles:t,sources:i={},introspection:r}={}){this.setGeneration(e),this.styles=t,this.sources=i,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=r||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof me||(me.isValid(this.material)||(this.material=Q.defaults.material),this.material=new me(this.material)),this.material.inject(this),be.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let i=t.meshes[e];0!==i.vertex_data.vertex_count?(i.vertex_data.end(),i.vertex_elements=i.vertex_data.element_buffer,i.vertex_data=i.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const i=this.tile_data[e.id].meshes;if(null==i[t.key]){const e=this.vertexLayoutForMeshVariant(t);i[t.key]={variant:t,vertex_data:e.createVertexData()}}return i[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;this.tile_data[r.id]||this.startData(r);let n=this.parseFeature(e,t,i);n&&this.buildGeometry(e.geometry,n,i)>0&&(e.generation=this.generation)},buildGeometry(e,t,i){let r;if("Polygon"===e.type?r=this.buildPolygons([e.coordinates],t,i):"MultiPolygon"===e.type?r=this.buildPolygons(e.coordinates,t,i):"LineString"===e.type?r=this.buildLines([e.coordinates],t,i):"MultiLineString"===e.type?r=this.buildLines(e.coordinates,t,i):"Point"===e.type?r=this.buildPoints([e.coordinates],t,i):"MultiPoint"===e.type&&(r=this.buildPoints(e.coordinates,t,i)),r>0&&b.layer_stats){let e=i.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,n=e.debug.layers.tree,s={};i.layers.forEach(e=>{Oe(t,e,1,r,{[this.name]:r},{[this.baseStyle()]:r});let i=n,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];i[t]=i[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},Oe(i,t,1,r,{[this.name]:r},{[this.baseStyle()]:r})),e<a.length-1&&(i[t].layers=i[t].layers||{}),i=i[t].layers,o=o[t]}})}return r},parseFeature(e,t,i){try{var r=this.feature_style;if(r.order=this.parseOrder(t.order,i),null==r.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void m({level:"warn",once:!0},e)}if(!(r=this._parseFeature(e,t,i)))return;if(this.shaders.attributes){r.attributes=r.attributes||{};for(const e in this.shaders.attributes)r.attributes[e]=Q.evalCachedProperty(t.attributes&&t.attributes[e],i),"number"!=typeof r.attributes[e]&&(r.attributes[e]=0)}return this.selection?r.interactive=Q.evalProperty(t.interactive,i):r.interactive=!1,!0===r.interactive?r.selection_color=ce.makeColor(e,i.tile,i):r.selection_color=ce.defaultColor,r}catch(t){m("error","Style.parseFeature: style parsing error",e,r,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let i=this.draw[t];"object"!=typeof i||Array.isArray(i)?null==e[t]&&(e[t]=i):e[t]=G({},i,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=Q.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?Q.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?Q.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Q.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=S.getMaxTextureSize(this.gl)},makeMesh(e,t,i={}){let r=this.vertexLayoutForMeshVariant(i.variant);return b.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let i=0;i<e.length;i+=3)t.set([e[i],e[i+1],e[i+1],e[i+2],e[i+2],e[i]],2*i);return t}(t),new pe(this.gl,e,t,r,Me(Me({},i),{},{draw_mode:this.gl.LINES}))):new pe(this.gl,e,t,r,i)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){m("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw m("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var i=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,n=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in n)null==n[e]&&m({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new U(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:n,blocks:i,block_scopes:r,extensions:s}),this.selection?this.selection_program=new U(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:n,blocks:i,block_scopes:r,extensions:s}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,i=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(i)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,i=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,i)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof Se).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let i;try{i=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!i||i.length<1)return t;if(i.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const r=t.uniforms.u_rasters=[],n=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return i.forEach(i=>{const o=i.index;if(r[o]=i.name,t.textures.push(i.name),n[o]=[i.width,i.height],e.coords.z>i.coords.z){let t=e.coords.z-i.coords.z,r=Math.pow(2,t);s[o]=[(e.coords.x%r+r)%r/r,(r-1-e.coords.y%r)/r,1/r]}else s[o]=[0,0,1]}),t},async loadTextures(e){let t={},i={},r=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((n,s)=>{n instanceof Se&&r.push(n.tileTexture(e,this).then(e=>{t[e.name]=e,i[e.name]=s}))}),await Promise.all(r),await S.createFromObject(this.gl,t);let n=await Promise.all(Object.keys(t).map(e=>S.textures[e]&&S.textures[e].load()).filter(e=>e));return n.forEach(e=>e.retain()),n.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:i[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,i]of Object.entries(this.shaders.attributes))"float"===i.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let i in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[i]?e.attributes[i]:0},setup(){this.setUniforms(),this.material.setupProgram(U.current)},setUniforms(){var e,t=U.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Oe(e,t,i,r,n,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=i,e[t].geoms+=r;for(let i in n)e[t].styles[i]=e[t].styles[i]||0,e[t].styles[i]+=n[i];for(let i in s)e[t].base[i]=e[t].base[i]||0,e[t].base[i]+=s[i]}let Ne=Math.pow(2,16)-1,Ce=!1;class Le{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!Ce||e>Ne&&(this.has_overflown=!0,!Ce)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&Ce?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}Le.setElementIndexUint=function(e){Ce=e};let Ie={[fe.FLOAT]:Float32Array,[fe.BYTE]:Int8Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.INT]:Int32Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.SHORT]:Int16Array,[fe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new Le,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),m("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[fe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=Ie[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),m("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class De{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,i=0;for(let e=0;e<this.attribs.length;e++){let r=this.attribs[e];if(null==r.static){r.offset=this.stride,r.byte_size=r.size;let e=0;switch(r.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:r.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:r.byte_size*=2,e=1}3&r.byte_size&&(r.byte_size+=4-(3&r.byte_size)),this.stride+=r.byte_size;let n=r.offset>>e;for(let t=0;t<r.size;t++)this.components.push({type:r.type,shift:e,offset:n++,index:i++});this.index[r.name]=t,t+=r.size,this.offset[r.name]=r.offset}else r.static=Array.isArray(r.static)?r.static:[r.static],r.method=`vertexAttrib${r.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in De.enabled_attribs)e.disableVertexAttribArray(t);De.enabled_attribs={},this.dynamic_attribs.forEach(i=>{const r=t.attribute(i.name).location;-1!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,this.stride,i.offset),De.enabled_attribs[r]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(i=>{const r=t.attribute(i.name).location;-1!==r&&e[i.method]instanceof Function&&(e.enableVertexAttribArray(r),e[i.method](r,i.static),e.disableVertexAttribArray(r))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=P(JSON.stringify(this.attribs));if(null==De.add_vertex_funcs[e]){let t,i=["var t, o;"],r=[...this.components];r.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<r.length;e++){let n=r[e];t!==n.type&&(i.push(`t = vs[${n.type}];`),i.push(`o = off${n.shift?" >> "+n.shift:""};`),t=n.type),i.push(`t[o + ${n.offset}] = v[${n.index}];`)}i=i.join("\n");let n=new Function("v","vs","off",i);De.add_vertex_funcs[e]=n}this.addVertex=De.add_vertex_funcs[e]}}De.enabled_attribs={},De.add_vertex_funcs={};const Ue=[{x:0,y:0},{x:V.tile_scale,y:-V.tile_scale}],je=[0,0,1,1];function Be(e,t,i){let r=Ue[0],n=Ue[1];return e[0]<=r.x+i&&t[0]<=r.x+i||e[0]>=n.x-i&&t[0]>=n.x-i||e[1]>=r.y-i&&t[1]>=r.y-i||e[1]<=n.y+i&&t[1]<=n.y+i}function Ge(e,t){t=t||0;let i=Ue[0],r=Ue[1];return e[0]<=i.x+t||e[0]>=r.x-t||e[1]>=i.y-t||e[1]<=r.y+t}var Ve,$e={exports:{}},qe=function(){if(Ve)return $e.exports;function e(e,n,s){s=s||2;var o,a,h,c,f,p,_,m=n&&n.length,g=m?n[0]*s:e.length,y=t(e,0,g,s,!0),b=[];if(!y||y.next===y.prev)return b;if(m&&(y=function(e,r,n,s){var o,a,h,c=[];for(o=0,a=r.length;o<a;o++)(h=t(e,r[o]*s,o<a-1?r[o+1]*s:e.length,s,!1))===h.next&&(h.steiner=!0),c.push(d(h));for(c.sort(l),o=0;o<c.length;o++)u(c[o],n),n=i(n,n.next);return n}(e,n,y,s)),e.length>80*s){o=h=e[0],a=c=e[1];for(var v=s;v<g;v+=s)(f=e[v])<o&&(o=f),(p=e[v+1])<a&&(a=p),f>h&&(h=f),p>c&&(c=p);_=0!==(_=Math.max(h-o,c-a))?1/_:0}return r(y,b,s,o,a,_),b}function t(e,t,i,r,n){var s,o;if(n===k(e,t,i,r)>0)for(s=t;s<i;s+=r)o=w(s,e[s],e[s+1],o);else for(s=i-r;s>=t;s-=r)o=w(s,e[s],e[s+1],o);return o&&m(o,o.next)&&(A(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!m(r,r.next)&&0!==_(r.prev,r,r.next))r=r.next;else{if(A(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function r(e,t,l,u,h,d,f){if(e){!f&&d&&function(e,t,i,r){var n=e;do{null===n.z&&(n.z=c(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,s,o,a,l,u=1;do{for(i=e,e=null,s=null,o=0;i;){for(o++,r=i,a=0,t=0;t<u&&(a++,r=r.nextZ);t++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=r}s.nextZ=null,u*=2}while(o>1)}(n)}(e,u,h,d);for(var p,_,m=e;e.prev!==e.next;)if(p=e.prev,_=e.next,d?s(e,u,h,d):n(e))t.push(p.i/l),t.push(e.i/l),t.push(_.i/l),A(e),e=_.next,m=_.next;else if((e=_)===m){f?1===f?r(e=o(i(e),t,l),t,l,u,h,d,2):2===f&&a(e,t,l,u,h,d):r(i(e),t,l,u,h,d,1);break}}}function n(e){var t=e.prev,i=e,r=e.next;if(_(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(f(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&_(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function s(e,t,i,r){var n=e.prev,s=e,o=e.next;if(_(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,u=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,d=c(a,l,t,i,r),p=c(u,h,t,i,r),m=e.prevZ,g=e.nextZ;m&&m.z>=d&&g&&g.z<=p;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&_(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&_(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=d;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&_(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=p;){if(g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&_(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function o(e,t,r){var n=e;do{var s=n.prev,o=n.next.next;!m(s,o)&&g(s,n,n.next,o)&&v(s,o)&&v(o,s)&&(t.push(s.i/r),t.push(n.i/r),t.push(o.i/r),A(n),A(n.next),n=e=o),n=n.next}while(n!==e);return i(n)}function a(e,t,n,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&p(l,u)){var h=x(l,u);return l=i(l,l.next),h=i(h,h.next),r(l,t,n,s,o,a),void r(h,t,n,s,o,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var i,r=t,n=e.x,s=e.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i;var l,u=i,c=i.x,d=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&f(s<d?n:o,s,c,d,s<d?o:n,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(n-r.x),v(r,e)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&h(i,r)))&&(i=r,p=l)),r=r.next}while(r!==u);return i}(e,t),t){var r=x(t,e);i(t,t.next),i(r,r.next)}}function h(e,t){return _(e.prev,e,t.prev)<0&&_(t.next,e,e.next)<0}function c(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function f(e,t,i,r,n,s,o,a){return(n-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&g(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(v(e,t)&&v(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(_(e.prev,e,t.prev)||_(e,t.prev,t))||m(e,t)&&_(e.prev,e,e.next)>0&&_(t.prev,t,t.next)>0)}function _(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,i,r){var n=b(_(e,t,i)),s=b(_(e,t,r)),o=b(_(i,r,e)),a=b(_(i,r,t));return n!==s&&o!==a||!(0!==n||!y(e,i,t))||!(0!==s||!y(e,r,t))||!(0!==o||!y(i,e,r))||!(0!==a||!y(i,t,r))}function y(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function b(e){return e>0?1:e<0?-1:0}function v(e,t){return _(e.prev,e,e.next)<0?_(e,t,e.next)>=0&&_(e,e.prev,t)>=0:_(e,t,e.prev)<0||_(e,e.next,t)<0}function x(e,t){var i=new T(e.i,e.x,e.y),r=new T(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function w(e,t,i,r){var n=new T(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function A(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function T(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function k(e,t,i,r){for(var n=0,s=t,o=i-r;s<i;s+=r)n+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return n}return Ve=1,$e.exports=e,$e.exports.default=e,e.deviation=function(e,t,i,r){var n=t&&t.length,s=n?t[0]*i:e.length,o=Math.abs(k(e,0,s,i));if(n)for(var a=0,l=t.length;a<l;a++){var u=t[a]*i,h=a<l-1?t[a+1]*i:e.length;o-=Math.abs(k(e,u,h,i))}var c=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,p=r[a+2]*i;c+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var s=0;s<e[n].length;s++)for(var o=0;o<t;o++)i.vertices.push(e[n][s][o]);n>0&&(r+=e[n-1].length,i.holes.push(r))}return i},$e.exports}(),We=O(qe);function Ze(e,t,i=0,r=e.length-1,n=Xe){for(;r>i;){if(r-i>600){const s=r-i+1,o=t-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Ze(e,t,Math.max(i,Math.floor(t-o*l/s+u)),Math.min(r,Math.floor(t+(s-o)*l/s+u)),n)}const s=e[t];let o=i,a=r;for(He(e,i,t),n(e[r],s)>0&&He(e,i,r);o<a;){for(He(e,o,a),o++,a--;n(e[o],s)<0;)o++;for(;n(e[a],s)>0;)a--}0===n(e[i],s)?He(e,i,a):(a++,He(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function He(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Xe(e,t){return e<t?-1:e>t?1:0}const Ye=[0,0,1];function Je(e,t,i,{texcoord_index:r,texcoord_scale:n,texcoord_normalize:s}){let o,a,l,u,h,c,d,f,p,_,m,g,y=t.vertex_elements,b=e.length,v=0;r&&(s=s||1,[o,a,l,u]=n||je);for(let n=0;n<b;n++){const b=500;let w=e[n];w.length>b&&(w=[...w],Ze(w,b,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,b));const A=(x=We.flatten(w),We(x.vertices,x.holes,x.dimensions)),T=A.length,k=t.vertex_count;if(T){r&&([h,c,d,f]=V.findBoundingBox(w),p=d-h,_=f-c,m=(l-o)/p,g=(u-a)/_);for(let e=0;e<w.length;e++){let n=w[e];for(let e=0;e<n.length;e++){let l=n[e];i[0]=l[0],i[1]=l[1],r&&(i[r+0]=((l[0]-h)*m+o)*s,i[r+1]=((l[1]-c)*g+a)*s),t.addVertex(i)}}for(let e=0;e<T;e++)y.push(k+A[e]);v+=T/3}}var x;return v}var Ke='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Qe="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Pe);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:!0,init(){Pe.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,i){var r=this.feature_style;return r.color=this.parseColor(t.color,i),r.color?(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.z*=V.height_scale,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&(!0===r.extrude?(r.height=e.properties.height||Q.defaults.height,r.min_height=e.properties.min_height||Q.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=V.height_scale,r.min_height*=V.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess(e){return e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.z=Q.createPropertyCache(e.z,Q.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,i=null!=e.extrude?1:0,r=this.texcoords?1:0,n=this.getBlendOrderForDraw(e),s=[t,i,r,n].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:n,mesh_order:0,selection:t,normal:i,texcoords:r})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_normal",size:3,type:fe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new De(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=127),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildPolygons(e,t,i){let r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=r.vertex_data,s=n.vertex_layout,o=this.makeVertexTemplate(t,r),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:V.tile_scale*i.tile.pad_scale*4,winding:i.winding};return t.extrude&&t.height?function(e,t,i,r,n,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:h,texcoord_scale:c,texcoord_normalize:d,winding:f}){var p=t+(r||0),_=t+i;s[2]=_;var m=Je(e,n,s,{texcoord_index:h,texcoord_scale:c,texcoord_normalize:d}),g=n.vertex_elements,y=n.vertex_count;if(h){d=d||1;var[b,v,x,w]=c||je,A=[[b,w],[b,v],[x,v],[x,w]]}for(var T=e.length,k=0;k<T;k++)for(var E=e[k],S=0;S<E.length;S++)for(var R=E[S],z=0;z<R.length-1;z++){if(l&&Be(R[z],R[z+1],u))continue;let e,t;"CCW"===f?(e=z,t=z+1):(e=z+1,t=z);var M=[[R[t][0],R[t][1],_],[R[t][0],R[t][1],p],[R[e][0],R[e][1],p],[R[e][0],R[e][1],_]];let i=ye.normalize([R[t][0]-R[e][0],R[t][1]-R[e][1],0]),r=ye.cross(Ye,i);s[o+0]=r[0]*a,s[o+1]=r[1]*a,s[o+2]=r[2]*a;for(var P=0;P<M.length;P++)s[0]=M[P][0],s[1]=M[P][1],s[2]=M[P][2],h&&(s[h+0]=A[P][0]*d,s[h+1]=A[P][1]*d),n.addVertex(s);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,m+=2}return m}(e,t.z,t.height,t.min_height,n,o,s.index.a_normal,127,a):Je(e,n,o,a)}});const tt=[0,0],it={butt:0,square:1,round:2},rt={miter:0,bevel:1,round:2},nt=V.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var i,r,n,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:h,v_scale:c,miter_len_sq:d}=t,f=null!=t.texcoord_index,p=0;if(l&&o===rt.miter){var _=function(e){if(Ge(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ge(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==_){var m=function(e,t){var i=[];for(let n=0;n<e.length;n++){var r=(n+t)%e.length;0!==r&&i.push(e[r])}return i.push(i[0]),i}(e,_);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(m)}}var g=0,y=e.length-1,b=0;for(i=e[g],r=e[g+1];ye.isEqual(i,r);)if(i=r,r=e[1+ ++g],b++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(b++,0===--y)return;if(!(e.length<2+b))if(s=ye.normalize(ye.perp(i,r)),u&&Be(i,r,h)){var v=ut(e,g,h);v&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(v))}else{l?function(e,t,i,r,n){if(void 0===r||Ge(e))pt(e,i,i,1,0,n,1),pt(e,i,i,0,0,n,-1);else{r===rt.miter?ct(0,e,t,i,n.miter_len_sq,!0,n):dt(r,0,e,t,i,!0,n)}}(i,n=ye.normalize(ye.perp(e[y-1],i)),s,o,t):(Ge(i)||(gt(i,p,s,a,!0,t),f&&a!==it.butt&&(p+=.5*c*t.texcoord_width)),pt(i,s,s,1,p,t,1),pt(i,s,s,0,p,t,-1)),f&&(p+=c*ye.length(ye.sub(r,i)));for(var x=g+1;x<y;x++){var w=x,A=x+1;if(i=e[w],r=e[A],!ye.isEqual(i,r)){if(u&&Be(i,r,h)){pt(i,s,s,1,p,t,1),pt(i,s,s,0,p,t,-1),ft(1,t);var T=ut(e,w+1,h);return void(T&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(T)))}n=s,s=ye.normalize(ye.perp(i,r)),o===rt.miter?ct(p,i,n,s,d,!1,t):dt(o,p,i,n,s,!1,t),f&&(p+=c*ye.length(ye.sub(r,i)))}}i=r,n=s,l?function(e,t,i,r,n,s){if(Ge(e))pt(e,t,t,1,n,s,1),pt(e,t,t,0,n,s,-1),ft(1,s);else{var o=ht(t,i);r===rt.miter&&ye.lengthSq(o)>s.miter_len_sq&&(r=rt.bevel),r===rt.miter?(pt(e,o,t,1,n,s,1),pt(e,o,t,0,n,s,-1),ft(1,s)):(pt(e,t,t,1,n,s,1),pt(e,t,t,0,n,s,-1),ft(1,s))}}(i,n,s=ye.normalize(ye.perp(i,e[1])),o,p,t):(pt(i,n,s,1,p,t,1),pt(i,n,s,0,p,t,-1),ft(1,t),Ge(i)||gt(i,p,n,a,!1,t))}}}function ut(e,t,i){for(var r=t;e[r+1]&&Be(e[r],e[r+1],i);)r++;return e.length-r>=2&&e.slice(r)}function ht(e,t){var i=ye.normalize(ye.add(e,t)),r=2/(1+Math.abs(ye.dot(e,i)));return ye.mult(i,r*r)}function ct(e,t,i,r,n,s,o){var a=ht(i,r);ye.lengthSq(a)>n?dt(rt.bevel,e,t,i,r,s,o):(pt(t,a,a,1,e,o,1),pt(t,a,a,0,e,o,-1),s||ft(1,o))}function dt(e,t,i,r,n,s,o){var a=ht(r,n),l=n[0]*r[1]-n[1]*r[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(pt(i,a,a,1,t,o,1),pt(i,r,a,0,t,o,-1),s||ft(1,o),mt(i,ye.neg(r),a,ye.neg(n),a,st,ot,st,!1,e===rt.bevel,o),pt(i,a,a,1,t,o,1),pt(i,n,a,0,t,o,-1)):(pt(i,r,a,1,t,o,1),pt(i,a,a,0,t,o,-1),s||ft(1,o),mt(i,r,ye.neg(a),n,a,ot,st,ot,!1,e===rt.bevel,o),pt(i,n,a,1,t,o,1),pt(i,a,a,0,t,o,-1))}function ft(e,t){for(var i=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,n=0;n<e;n++)i.push(r+2*n+2),i.push(r+2*n+1),i.push(r+2*n+0),i.push(r+2*n+2),i.push(r+2*n+3),i.push(r+2*n+1),t.geom_count+=2}function pt(e,t,i,r,n,s,o){var a=s.vertex_template,l=s.vertex_data;a[0]=e[0],a[1]=e[1];let u=s.half_width*o;a[s.extrude_index+0]=t[0]*u,a[s.extrude_index+1]=t[1]*u,s.offset&&(a[s.offset_index+0]=i[0]*s.offset,a[s.offset_index+1]=i[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*r,a[s.texcoord_index+1]=65535*n),l.addVertex(a)}var _t=[0,0];function mt(e,t,i,r,n,s,o,a,l,u,h){for(var c=t[0]*r[1]-t[1]*r[0],d=ye.dot(t,r),f=Math.atan2(c,d);f>=Math.PI;)f-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var i=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*i)}(f,h.half_width);if(p<1)return}var _=h.vertex_data.vertex_count,m=h.vertex_data.vertex_elements;pt(e,i,n,o[0],o[1],h,1),pt(e,t,n,s[0],s[1],h,1);var g=t,y=null!=h.texcoord_index;if(y)if(l)var b=ye.sub(s,o);else{_t=ye.copy(s);var v=ye.div(ye.sub(a,s),p)}var x=f/p;let w,A,T=f<0?-1:1;c>0?(w=2,A=1):(w=1,A=2);for(var k=0;k<p;k++)0===k&&f<0&&(g=ye.neg(g)),g=ye.rot(g,x),y&&(l?(b=ye.rot(b,x),_t[0]=b[0]+o[0],_t[1]=b[1]*h.texcoord_width*h.v_scale+o[1]):_t=ye.add(_t,v)),pt(e,g,n,_t[0],_t[1],h,T),m.push(_+k+w),m.push(_),m.push(_+k+A)}function gt(e,t,i,r,n,s){var o=ye.neg(i),a=null!=s.texcoord_index;switch(r){case it.square:var l;n?(l=[i[1],-i[0]],pt(e,ye.add(i,l),i,1,t,s,1),pt(e,ye.add(o,l),i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,i,i,1,t,s,1),pt(e,o,i,0,t,s,1)):(l=[-i[1],i[0]],pt(e,i,i,1,t,s,1),pt(e,o,i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,ye.add(i,l),i,1,t,s,1),pt(e,ye.add(o,l),i,0,t,s,1)),ft(1,s);break;case it.round:var u,h,c=st,d=ot,f=at;n?(u=i,h=o,a&&(t+=.5*s.texcoord_width*s.v_scale,c=ot,d=st,f=at)):(u=o,h=i),a&&(st[1]=t,ot[1]=t,at[1]=t),mt(e,u,tt,h,i,c,f,d,!0,!1,s);break;case it.butt:return}}const yt=[255,255,255,255],bt=[0,0,0,0],vt=Object.create(Pe);Object.assign(vt,{name:"lines",built_in:!0,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:!0,init(){Pe.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>Q.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let i=this.calcDistance(e,t);return t.zoom--,i},calcWidth(e,t,i){let r,n=this.calcDistance(e.width,i);if(!(n<0)){if(r=e.next_width?this.calcDistanceNextZoom(e.next_width,i):n/2,0===n&&0===r||r<0)return!1;if(t.width_unscaled=n,t.next_width_unscaled=r,e.next_width){r*=2;let e=.5*(n+r);t.width=e*i.units_per_meter_overzoom,t.width_scale=1-r/e}else t.width=n*i.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*i.units_per_meter_overzoom/i.tile.overzoom2),!0}},calcOffset(e,t,i){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let r=this.calcDistance(e.offset,i);if(e.next_offset){let n=2*this.calcDistanceNextZoom(e.next_offset,i);Math.abs(r)>=Math.abs(n)?(t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0!==r?1-n/r:0):(t.offset=n*i.units_per_meter_overzoom,t.offset_scale=0!==n?-1*(1-r/n):0)}else t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,i){var r=this.feature_style;if(!1!==this.calcWidth(t,r,i)&&(this.calcOffset(t,r,i),r.color=this.parseColor(t.color,i),r.color)){if(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.height=e.properties.height||Q.defaults.height,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=V.height_scale,r.cap=t.cap,r.join=t.join,r.miter_limit=t.miter_limit,r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,i),n=2*this.calcDistanceNextZoom(t.outline.next_width,i);0===e&&0===n||e<0||n<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=!1):(r.outline.width.value=e+r.width_unscaled,r.outline.next_width.value=n+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.alpha=t.outline.alpha,r.outline.interactive=t.outline.interactive,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.extrude=t.outline.extrude,r.outline.z=t.outline.z,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,i):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5)}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess(e){if(e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.width=Q.createPropertyCache(e.width,Q.parseUnits),e.width&&e.width.type!==Q.CACHE_TYPE.STATIC&&(e.next_width=Q.createPropertyCache(e.width,Q.parseUnits)),e.offset=e.offset&&Q.createPropertyCache(e.offset,Q.parseUnits),e.offset&&e.offset.type!==Q.CACHE_TYPE.STATIC&&(e.next_offset=Q.createPropertyCache(e.offset,Q.parseUnits)),e.z=Q.createPropertyCache(e.z,Q.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&Q.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.next_width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&Q.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const i=function(e,t={}){const i=t.dash_color||yt,r=t.background_color||bt,n=e,s=t.scale||1;n.length%2==1&&Array.prototype.push.apply(n,n);let o=!0,a=[];for(let e=0;e<n.length;e++){let t=Math.floor(n[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?i:r);o=!o}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});S.create(this.gl,t,{data:i.pixels,height:i.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Pe.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=S.default,t.uniforms.u_v_scale_adjust=V.tile_scale;let i=[];for(let r in t.meshes){let n=t.meshes[r].variant;if(n.texture){let s=t.meshes[r].uniforms=t.meshes[r].uniforms||{};if(s.u_has_line_texture=!0,s.u_texture=n.texture,s.u_texture_ratio=1,n.dash&&(s.u_v_scale_adjust=20*V.tile_scale,s.u_has_dash=null!=n.dash_background_color?1:0,s.u_dash_background_color=n.dash_background_color||[0,0,0,0]),n.dash_key&&null==this.dash_textures[n.dash_key]){this.dash_textures[n.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",n.dash)}catch(e){m("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==S.textures[n.texture])i.push(S.syncTexturesToWorker([n.texture]).then(e=>{let t=e[n.texture];t&&(s.u_texture_ratio=t.height/t.width)}));else{let e=S.textures[n.texture];s.u_texture_ratio=e.height/e.width}}}await Promise.all(i)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const i=this.getBlendOrderForDraw(e);t+="/"+i,t=P(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:i,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:fe.SHORT,normalized:!1},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new De(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=1024*e.width_scale,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=0,this.vertex_template[i++]=0,t.variant.offset&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),t.variant.z_or_offset&&(this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildLines(e,t,i,r){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var n=this.styles[t.outline.style];n&&n.addFeature(i.feature,t.outline,i)}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,i,r,n,s,o,a){var l,u=t.cap?it[t.cap]:it.butt,h=t.join?rt[t.join]:rt.miter;if(h===rt.miter){const e=t.miter_limit||3;var c=e*e}n.a_texcoord&&(l=1/(t.texcoord_width*nt));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:c,join_type:h,cap_type:u,vertex_data:i,vertex_template:r,half_width:t.width/2,extrude_index:n.a_extrude,offset_index:n.a_offset,v_scale:l,texcoord_index:n.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],d);if(d.extra_lines)for(let e=0;e<d.extra_lines.length;e++)lt(d.extra_lines[e],d);return d.geom_count}(e,t,o,this.makeVertexTemplate(t,s),a.index,r&&r.closed_polygon,!t.tile_edges&&r&&r.remove_tile_edges,V.tile_scale*i.tile.pad_scale*2)},buildPolygons(e,t,i){let r=0;for(let n=0;n<e.length;n++)r+=this.buildLines(e[n],t,i,{closed_polygon:!0,remove_tile_edges:!0});return r}});const xt=128/Math.PI,wt=16384/Math.PI,At=[0,2,2,0],Tt=[1,1,3,3],kt=new Array(4),Et=["left","top-left","bottom-left"],St=["right","top-right","bottom-right"],Rt=["top","top-left","top-right"],zt=["bottom","bottom-left","bottom-right"],Mt={computeOffset(e,t,i,r=null){if(!i||"center"===i)return e;let n=[e[0],e[1]];return r=r||this.default_buffer,this.isLeftAnchor(i)?(n[0]-=t[0]/2,"left"===i&&(n[0]-=r[0])):this.isRightAnchor(i)&&(n[0]+=t[0]/2,"right"===i&&(n[0]+=r[1])),this.isTopAnchor(i)?(n[1]-=t[1]/2,"top"===i&&(n[1]-=r[2])):this.isBottomAnchor(i)&&(n[1]+=t[1]/2,"bottom"===i&&(n[1]+=r[3])),n},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>Et.indexOf(e)>-1,isRightAnchor:e=>St.indexOf(e)>-1,isTopAnchor:e=>Rt.indexOf(e)>-1,isBottomAnchor:e=>zt.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Pt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Ot=[[1,0],[0,1]],Nt=[],Ct=[];let Lt,It,Ft,Dt;class Ut{constructor(e,t,i,r,n){this.dimension=[r/2,n/2],this.angle=i,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=ye.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ye.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],i=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-i,e[0]+t,e[1]-i,e[0]+t,e[1]+i,e[0]-t,e[1]+i],this.axis_0=Ot[0],this.axis_1=Ot[1];else{let r=Math.cos(this.angle)*t,n=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*i,o=Math.cos(this.angle)*i;this.quad=[e[0]-r-s,e[1]-n-o,e[0]+r-s,e[1]+n-o,e[0]+r+s,e[1]+n+o,e[0]-r+s,e[1]-n+o],this.updateAxes()}}static projectToAxis(e,t,i){let r=e.quad;return Lt=r[0]*t[0]+r[1]*t[1],It=r[2]*t[0]+r[3]*t[1],Ft=r[4]*t[0]+r[5]*t[1],Dt=r[6]*t[0]+r[7]*t[1],i[0]=Math.min(Lt,It,Ft,Dt),i[1]=Math.max(Lt,It,Ft,Dt),i}static axisCollide(e,t,i,r){return Ut.projectToAxis(e,i,Nt),Ut.projectToAxis(t,i,Ct),!(Ct[0]>Nt[1]||Ct[1]<Nt[0]||(Ut.projectToAxis(e,r,Nt),Ut.projectToAxis(t,r,Ct),Ct[0]>Nt[1]||Ct[1]<Nt[0]))}static intersect(e,t){return Ut.axisCollide(e,t,e.axis_0,e.axis_1)&&Ut.axisCollide(e,t,t.axis_0,t.axis_1)}}class jt{constructor(e,t={}){this.id=jt.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Mt.alignForAnchor(this.anchor)}occluded(e,t=null){let i=!1,r=e.aabb,n=e.obb;return r.length>0&&function(e,t,i){for(let r=0;r<t.length&&(!Pt(e,t[r])||null==i(r));r++);}(this.aabb,r,e=>{if(!t||r[e]!==t.aabb)return 0===this.obb.angle&&0===n[e].angle||Ut.intersect(this.obb,n[e])?(i=!0,!0):void 0}),i}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-V.tile_scale&&this.aabb[0]<V.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-V.tile_scale&&this.aabb[2]<V.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-V.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-V.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}jt.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let i=0;i<e.aabbs.length;i++)t.aabb.push(e.aabbs[i]),t.obb.push(e.obbs[i])},jt.id=0,jt.id_prefix=0,jt.id_multiplier=0,jt.nextLabelId=function(){return jt.id_prefix+jt.id++*jt.id_multiplier},jt.epsilon=.9999;class Gt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let i=this.positions[e],r=t[0]-i[0],n=t[1]-i[1];if(r*r+n*n<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,i){if(t.repeat_distance&&t.repeat_group&&this.groups[i][t.repeat_group])return this.groups[i][t.repeat_group].check(e)}static add(e,t,i){t.repeat_distance&&t.repeat_group&&(null==this.groups[i][t.repeat_group]&&(this.groups[i][t.repeat_group]=new Gt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[i][t.repeat_group].add(e))}}Gt.groups={};class Vt{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const i=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=i[1];t<=i[3];t++){this.cells[t]=this.cells[t]||{};for(let r=i[0];r<=i[2];r++)this.cells[t][r]=this.cells[t][r]||{aabb:[],obb:[]},e.cells.push(this.cells[t][r])}}}const $t={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Vt(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:i=!1}={}){let r=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:i};null==r.complete&&(r.complete=new Promise((e,t)=>{r.resolve=e,r.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,i){let r=this.tiles[i];if(!r)return m("trace","Collision.collide() called with null tile",i,this.tiles,t,e),Promise.resolve([]);let n=r.objects;for(let i=0;i<e.length;i++){let r=e[i],s=r.label.layout.priority;n[s]=n[s]||{},n[s][t]=n[s][t]||[],n[s][t].push(r)}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(i),r.complete.then(()=>(r.resolve=null,r.labels[t]||[]))},endTile(e){let t=this.tiles[e],i=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Gt.clear(e);let r=Object.keys(t.objects).sort((e,t)=>e-t);for(let n=0;n<r.length;n++){let s=t.objects[r[n]];if(s)for(let r in s){let n=s[r];i[r]=i[r]||[];for(let s=0;s<n.length;s++){let o=n[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=!0,(o.label.breach||o.linked.label.breach)&&(o.label.breach=!0,o.linked.label.breach=!0),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=!0,o.linked.label.may_repeat_across_tiles=!0),i[r].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=!1,i[r].push(o)):(o.show=!0,i[r].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=!1,i[r].push(o))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const i=t.objects[e];if(i)for(const e in i)i[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,i=null,{repeat:r=!0}={}){let n=e.label,s=e.label.layout;if(null!=n.placed)return n.placed;let o=!s.collide;if(o||(o=this.grid&&n.cells?n.cells.reduce((e,t)=>(e&&n.discard(t,i&&i.label)&&(e=!1),e),!0):!n.discard(this.tiles[t].bboxes,i&&i.label)),o){if(!r||!Gt.check(n,s,t))return!0;n.placed=!1}else s.collide&&(n.placed=!1);return n.placed},place({label:e},t,{repeat:i=!0}){null==e.placed&&(i&&Gt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>jt.add(e,t)):jt.add(e,this.tiles[t].bboxes))}};class qt extends jt{constructor(e,t,i,r=0){super(t,i),this.type="point",this.position=[e[0],e[1]],this.angle=r,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Mt.computeOffset(this.offset,e.size,e.anchor,Mt.zero_buffer),this.offset=Mt.computeOffset(this.offset,e.size,this.anchor,Mt.zero_buffer),e.offset!==Q.zeroPair&&(this.offset===Q.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Mt.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*jt.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*jt.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new Ut(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let i=this.start_anchor_index;i<this.layout.anchor.length;i++)if(this.anchor=this.layout.anchor[i],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Wt=qt.PLACEMENT;function Zt(e,t,i){const r=[],n=i.placement,s=Math.max(t[0],t[1])*i.placement_min_length_ratio*i.units_per_pixel;if(n===Wt.SPACED){let n=function(e,t,i){let r=i.units_per_pixel,n=(i.placement_spacing||80)*r,s=function(e){let t=0;for(let i=0;i<e.length-1;i++)t+=Xt(e[i],e[i+1]);return t}(e);if(s<=t)return!1;let o=Math.max(Math.floor(s/n),1),a=[],l=[],u=.5*(s-(o-1)*n);for(let r=0;r<o;r++){let{position:r,angle:s}=Yt(e,u,t,i);null!=r&&null!=s&&(a.push(r),l.push(s)),u+=n}return{positions:a,angles:l}}(e,s,i);if(!n)return[];let o=n.positions,a=n.angles;for(let e=0;e<o.length;e++){let n=o[e],s=a[e];!0!==i.tile_edges&&Ge(n)||r.push(new qt(n,t,i,s))}}else if(n===Wt.VERTEX){let n,s;for(let o=0;o<e.length-1;o++)if(n=e[o],s=e[o+1],!0===i.tile_edges||!Ge(n)){const e=Ht(n,s,i.angle);r.push(new qt(n,t,i,e))}const o=Ht(n,s,i.angle);r.push(new qt(s,t,i,o))}else if(n===Wt.MIDPOINT)for(let n=0;n<e.length-1;n++){let o=e[n],a=e[n+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((!0===i.tile_edges||!Ge(l))&&(!s||Xt(o,a)>s)){const e=Ht(o,a,i.angle);r.push(new qt(l,t,i,e))}}return r}function Ht(e,t,i=0){return"auto"===i?Math.atan2(t[0]-e[0],t[1]-e[1]):i}function Xt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Yt(e,t,i,r){let n,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const h=Xt(l,u);if(!(h<=i)&&(o+=h,o>t)){n=Jt(l,u,o-t),s=Ht(l,u,r.angle);break}}return{position:n,angle:s}}function Jt(e,t,i){let r=i/Xt(e,t);return[r*e[0]+(1-r)*t[0],r*e[1]+(1-r)*t[1]]}const Kt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,g.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const i={};e.font=e.font||this.defaults,i.supersample=e.supersample_text?1.5:1,i.can_articulate=e.can_articulate,i.fill=Q.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),i.fill=g.toCSSColor(i.fill),e.font.stroke&&e.font.stroke.color&&(i.stroke=Q.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),i.stroke=g.toCSSColor(i.stroke),i.stroke_width=Q.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||i.can_articulate||(i.underline_width=1.5*i.supersample),e.font.background&&!i.can_articulate&&(i.background_color=Q.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),i.background_color=g.toCSSColor(i.background_color),i.background_color&&(i.background_width=Q.evalCachedProperty(e.font.background.width,t)),i.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&Q.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),i.background_stroke_color&&(i.background_stroke_color=g.toCSSColor(i.background_stroke_color),i.background_stroke_width=null!=e.font.background.stroke.width?Q.evalCachedProperty(e.font.background.stroke.width,t):1)),i.weight=Q.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof i.weight&&(i.weight=Math.min(Math.max(i.weight,1),1e3)),e.font.family?(i.family=e.font.family,i.family!==this.defaults.family&&(i.family+=", "+this.defaults.family)):i.family=this.defaults.family,i.style=e.font.style||this.defaults.style,i.transform=e.font.transform,i.px_size=Q.evalCachedProperty(e.font.px_size,t)*i.supersample,i.font_css=this.fontCSS(i);let r=e.text_wrap;return null!=r||i.can_articulate||(r=!0),!0===r&&(r=this.defaults.text_wrap),i.text_wrap=r,i.max_lines=e.max_lines||this.defaults.max_lines,i},fontCSS:({style:e,weight:t,px_size:i,family:r})=>[e,t,i+"px",r].filter(e=>e).join(" ")};var Qt,ei,ti={exports:{}},ii=O((Qt||(Qt=1,ei=ti,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function i(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function r(e){var t=e.a.offsetWidth,i=t+100;return e.f.style.width=i+"px",e.c.scrollLeft=i,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function n(t,i){function n(){var e=s;r(e)&&e.a.parentNode&&i(e.g)}var s=t;e(t.b,n),e(t.c,n),r(t)}function s(e,t){var i=t||{};this.family=e,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}var o=null,a=null,l=null,u=null;function h(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function c(e,t){return[e.style,e.weight,h()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,r){var s=this,l=e||"BESbswy",h=0,d=r||3e3,f=(new Date).getTime();return new Promise(function(e,r){var p;if(null===u&&(u=!!document.fonts),(p=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!a),p){p=new Promise(function(e,t){!function i(){(new Date).getTime()-f>=d?t():document.fonts.load(c(s,'"'+s.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(i,25)},function(){t()})}()});var _=new Promise(function(e,t){h=setTimeout(t,d)});Promise.race([_,p]).then(function(){clearTimeout(h),e(s)},function(){r(s)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=m&&-1!=g||-1!=m&&-1!=y||-1!=g&&-1!=y)&&((t=m!=g&&m!=y&&g!=y)||(null===o&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),o=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=o&&(m==b&&g==b&&y==b||m==v&&g==v&&y==v||m==x&&g==x&&y==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(h),e(s))}var u=new t(l),p=new t(l),_=new t(l),m=-1,g=-1,y=-1,b=-1,v=-1,x=-1,w=document.createElement("div");w.dir="ltr",i(u,c(s,"sans-serif")),i(p,c(s,"serif")),i(_,c(s,"monospace")),w.appendChild(u.a),w.appendChild(p.a),w.appendChild(_.a),document.body.appendChild(w),b=u.a.offsetWidth,v=p.a.offsetWidth,x=_.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)w.parentNode&&w.parentNode.removeChild(w),r(s);else{var t=document.hidden;!0!==t&&void 0!==t||(m=u.a.offsetWidth,g=p.a.offsetWidth,y=_.a.offsetWidth,a()),h=setTimeout(e,50)}}(),n(u,function(e){m=e,a()}),i(u,c(s,'"'+s.family+'",sans-serif')),n(p,function(e){g=e,a()}),i(p,c(s,'"'+s.family+'",serif')),n(_,function(e){y=e,a()}),i(_,c(s,'"'+s.family+'",monospace'))})})},ei.exports=s}()),ti.exports));const ri={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const i in e)Array.isArray(e[i])?e[i].forEach(e=>t.push(this.loadFontFace(i,e))):t.push(this.loadFontFace(i,e[i]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const i={family:e};"object"==typeof t&&(Object.assign(i,t),"string"==typeof t.url&&await this.injectFontFace(i));try{i.weight="string"==typeof i.weight?i.weight.split(" ")[0]:i.weight;const t=new ii(e,i);await t.load(),m("debug",`Font face '${e}' is available`,i)}catch(t){m("warn",`Font face '${e}' is NOT available`,i,t)}},async injectFontFace({family:e,url:t,weight:i,style:r}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let n=t;if("blob:"===t.slice(0,5)){n=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(n);if(this.supports_native_font_loading)n=e;else{let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);n="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof n?t=new FontFace(e,`url(${encodeURI(n)})`,{weight:i,style:r}):n instanceof Uint8Array&&(t=new FontFace(e,n,{weight:i,style:r})),document.fonts.add(t),m("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${i||"normal"};\n font-style: ${r||"normal"};\n src: url(${encodeURI(n)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),m("trace","Injecting CSS font face:",t)}}},ni=new RegExp("[֑-߿‏‫‮יִ-﷽ﹰ-ﻼ]");function si(e){return ni.test(e)}const oi="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029‬ -⯿",ai=new RegExp("["+oi+"]+");function li(e){return ai.test(e)}const ui=new RegExp("^["+oi+"؀-ۿ]+"),hi=new RegExp("["+oi+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),ci=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),di="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-⃿]",fi=new RegExp(`^.(?:${di}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${di}+)?)*`),pi={Mongolian:"᠀-᢯"},_i=Object.keys(pi).map(e=>pi[e]).join(""),mi=new RegExp("["+_i+"]");function gi(e,t,i){const r=t?1:2;if(e.length<r)return[e];let n=e;if(i.segment[n])return i.stats.segment_hits++,i.segment[n];let s=[];if(ui.exec(e)){s=e.split(hi);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=ci.exec(s[o]);e&&(s[o]=s[o].substring(e[0].length),s[o-1]+=e[0],t+=e[0].length)}t+=1+s[o].length,s[o]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",i=e,n=0;for(;n<r&&i.length;n++){let e=(fi.exec(i)||i)[0];t+=e,i=i.substring(e.length)}s.push(t),e=e.substring(t.length)}return t&&s.reverse(),i.stats.segment_misses++,i.segment[n]=s,s}class yi{constructor(e,t=1/0,i=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=i,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new bi(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(yi.ellipsis).width);e.append(yi.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,i,r,n){let s;s="number"==typeof t?e.split(" "):[e];let o=new yi(n,i,t),a=o.createLine(r);for(let e=0;e<s.length;e++){let i=s[e].split("\n"),n=0===e;for(let s=0;s<i.length&&a;s++){let l=i[s];si(l)&&li(l[l.length-1])&&(l+="‏");let u=n?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,r),!a)break;a.append(l),n=!0}else a.append(u);s<i.length-1&&(a=o.advance(a,r),n=!0)}e===s.length-1&&o.finish(a)}return o}}yi.ellipsis="...";class bi{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function vi(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function xi(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?vi(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):vi(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}class wi{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:i,stroke_width:r,px_size:n,supersample:s}){this.px_size=n;let o=this.context,a=g.device_pixel_ratio*s;i&&r>0&&(o.strokeStyle=i,o.lineWidth=r*a),o.fillStyle=t,o.font=e,o.miterLimit=2}async textSizes(e,t){return await ri.loadFonts(),T.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:i}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let n=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(i[n]));let s=i[n],o=!0;for(;t.text_idx<t.texts.length;){let i=t.texts[t.text_idx],a=s[i],l=a.text_settings;if(o&&(this.setFont(l),o=!1),a.size=this.textSize(n,i,l).size,l.can_articulate){let e=!1,t=!1;if(si(i)&&(li(i)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(r=i,mi.test(r)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=gi(i,e,wi.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(n,t[e],l).size)}}if(t.text_idx++,!T.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var r;return T.finish(e,i),!0}textSize(e,t,{transform:i,text_wrap:r,max_lines:n,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:h}){if(wi.cache.text[e]=wi.cache.text[e]||{},wi.cache.text[e][t])return wi.cache.stats.text_hits++,wi.cache.text[e][t];wi.cache.stats.text_misses++,wi.cache.text_count++;const c=g.device_pixel_ratio*h,d=this.applyTextTransform(t,i),f=this.context,p=this.vertical_text_buffer*c,_=(s+this.horizontal_text_buffer)*c;l=null!=l?l:this.background_size;const m=o||a?(l+a)*c:0,y=(2+u+(u?s+1:0))*c,b=this.px_size+y;let{width:v,height:x,lines:w}=yi.parse(d,r,n,b,f);v+=2*m,x+=2*m;let A=[v/c,x/c],T=[v+2*_,x+2*p],k=[T[0]/c,T[1]/c];return wi.cache.text[e][t]={lines:w,size:{collision_size:A,texture_size:T,logical_size:k,horizontal_buffer:_,vertical_buffer:p,dpr:c,line_height:b,background_size:m}},wi.cache.text[e][t]}drawTextMultiLine(e,[t,i],r,n,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:h,vertical_buffer:c}=r;if(n.background_color||n.background_stroke_color){const e=n.background_stroke_color,r=(n.background_stroke_width||0)*o;this.context.save(),n.background_color&&(this.context.fillStyle=n.background_color,this.context.fillRect(t+h+("curved"===s?l[0]:0)+r,i+c+r,o*a[0]-2*r,o*a[1]-2*r)),e&&r&&(this.context.strokeStyle=e,this.context.lineWidth=r,this.context.strokeRect(t+h+("curved"===s?l[0]:0)+.5*r,i+c+.5*r,o*a[0]-r,o*a[1]-r)),this.context.restore()}const d=n.underline_width||0,f=n.stroke_width||0;let p=i-(d?.5*(d+f+1)*o:0);for(let i=0;i<e.length;i++){let o=e[i];this.drawTextLine(o,[t,p],r,n,s),p+=u}this.drawTextDebug([t,i],r,s)}drawTextLine(e,[t,i],r,n,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=n,{horizontal_buffer:h,vertical_buffer:c,texture_size:d,background_size:f,line_height:p,dpr:_}=r,m=(n.underline_width||0)*_,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+h+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-h-f);const b=i+.75*c+p+f-.5*m,v=o&&a>0&&"curved"===s?d[0]:0;if(m){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=m;const t=b+(.5*a+2)*_+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(y+v,t),this.context.lineTo(y+v+e.width,t),this.context.stroke(),this.context.restore()}o&&a>0&&this.context.strokeText(g,y+v,b),this.context.fillText(g,y,b)}drawTextDebug([e,t],i,r){const{dpr:n,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=i;b.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,n*l[0],n*l[1]),"curved"===r&&this.context.strokeRect(e+a[0]+s,t+o,n*l[0],n*l[1]),this.context.restore()),b.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===r&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,i,r,n){return T.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:r,gl:n,tile_id:i,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:i,texts:r,textures:n}=e;for(;i.texture_idx<e.textures.length;){for(t=n[i.texture_idx],i.texture_resize&&(i.texture_resize=!1,this.resize(...t.texture_size));i.style_idx<i.styles.length;){let n=i.styles[i.style_idx];null==i.text_idx&&(i.text_idx=0,i.texts=Object.keys(r[n]));let s=r[n],o=!0;for(;i.text_idx<i.texts.length;){let r=i.texts[i.text_idx],a=s[r],l=a.text_settings;if(o&&(this.setFont(l),o=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let s=a.type[e];if("straight"===s){if(a.textures[e]!==i.texture_idx)continue;let o,u=a.isRTL?r.split().reverse().join():r,h=t.texcoord_cache[n][u];if(h.texcoord)o=h.texcoord;else{let e=h.texture_position,{size:i,lines:r}=this.textSize(n,u,l);this.drawTextMultiLine(r,e,i,l,s),o=S.getTexcoordsForSprite(e,i.texture_size,t.texture_size),h.texcoord=o}a.texcoords[s]={texcoord:o,texture_id:h.texture_id}}else if("curved"===s){let r=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<r.length;o++){if(a.textures[e][o]!==i.texture_idx)continue;let u,h,c=r[o],d=t.texcoord_cache[n][c];if(d.texcoord)u=d.texcoord,h=d.texcoord_stroke,a.texcoords_stroke.push(h);else{let e=d.texture_position,{size:i,lines:r}=this.textSize(n,c,l);this.drawTextMultiLine(r,e,i,l,s),u=S.getTexcoordsForSprite(e,i.texture_size,t.texture_size);let o=[e[0]+i.texture_size[0],e[1]];h=S.getTexcoordsForSprite(o,i.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=h,a.texcoords_stroke.push(h)}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id})}}}}else{let e=this.textSize(n,r,l).lines;const s=xi({},l);for(let r in a.align)a.align[r].texture_id===i.texture_idx&&(s.align=r,this.drawTextMultiLine(e,a.align[r].texture_position,a.size,s),a.align[r].texcoords=S.getTexcoordsForSprite(a.align[r].texture_position,a.size.texture_size,t.texture_size))}if(i.text_idx++,!T.shouldContinue(e))return!1}i.text_idx=null,i.style_idx++}let s=e.texture_prefix+i.texture_idx;S.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),S.retain(s),i.texture_names.push(s),i.texture_idx++,i.texture_resize=!0,i.style_idx=0}return T.finish(e,i.texture_names),!0}cancelRasterizeTask(e){m("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>S.release(e))}setTextureTextPositions(e,t){let i={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},r=[];for(let n in e){let s=e[n];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],i.texcoord_cache[n]=i.texcoord_cache[n]||{};for(let s=0;s<a.type.length;s++){let l=a.type[s];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!i.texcoord_cache[n][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o}}a.textures[s]=i.texture_id}else if("curved"===l){a.textures[s]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!i.texcoord_cache[n][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o}}a.textures[s].push(i.texture_id)}}}}else{let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],n,i,r,t),a.align[s].texture_id=i.texture_id,a.align[s].texture_position=o}}}return i.column_width>0&&i.height>0&&(r[i.texture_id]={texture_size:[i.width,i.height],texcoord_cache:i.texcoord_cache}),r}placeText(e,t,i,r,n,s){let o;return r.cy+t>s?(r.cx+=r.column_width,r.cy=0,r.column_width=e):r.column_width=Math.max(r.column_width,e),r.cx+r.column_width<=s?(o=[r.cx,r.cy],r.cy+=t,r.height=Math.max(r.height,r.cy),r.width=Math.max(r.width,r.cx+r.column_width)):(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache},r.texcoord_cache={},r.texcoord_cache[i]={},r.texture_id++,r.cx=0,r.cy=t,r.column_width=e,r.width=e,r.height=t,o=[0,0]),o}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,i]=e.match(wi.font_size_re)||[];return i=i||"px","em"===i?t*=16:"pt"===i?t/=.75:"%"===i&&(t/=6.25),t=Q.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){wi.cache.text_count>wi.cache.text_count_max&&(wi.cache.text={},wi.cache.text_count=0,m("debug","TextCanvas: pruning text cache")),Object.keys(wi.cache.segment).length>wi.cache.segment_count_max&&(wi.cache.segment={},m("debug","TextCanvas: pruning segment cache"))}}function Ai(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}wi.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,wi.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Ti=0;const ki={resetText(){t.is_main?this.canvas=new wi:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,i,r){let n=this.parseTextSource(e,t,i);if(null==n||""===n)return;let s=Kt.compute(t,i),o=Kt.key(s);this.texts[r.id]=this.texts[r.id]||{};let a=this.texts[r.id][o]=this.texts[r.id][o]||{};if(n instanceof Object){let l=[],u=n.left+"-"+n.right;for(let h in n){let c=n[h];if(!c)continue;let d=this.computeTextLayout({},e,t,i,r,c,s,u,h);a[c]||(a[c]={text_settings:s,ref:0}),l.push({draw:t,text:c,text_settings_key:o,layout:d})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,i,r,n,s);return a[n]||(a[n]={text_settings:s,ref:0}),{draw:t,text:n,text_settings_key:o,layout:l}}},parseTextSource(e,t,i){let r,n=t.text_source||"name";if(null==n||Array.isArray(n)||"object"!=typeof n)r=this.parseTextSourceValue(n,e,i);else{r={};for(let t in n)r[t]=this.parseTextSourceValue(n[t],e,i)}return r},parseTextSourceValue(e,t,i){let r;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if("string"==typeof e[n]?r=t.properties[e[n]]:"function"==typeof e[n]&&(r=e[n](i)),r)return r}else"string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(i));return r},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const i=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(m("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=i||[],i?this.buildTextLabels(e,t):($t.abortTile(e.id),[]))}catch(t){return $t.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,i){let r=await this.prepareTextLabels(e,i);if(0===r.length)return $t.collide([],t,e.id),{};if(r=await $t.collide(r,t,e.id),e.canceled)return m("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===r.length)return{};this.cullTextStyles(s,r),r.forEach(e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text];i.text_settings.can_articulate?(i.type||(i.type=[]),-1===i.type.indexOf(e.label.type)&&i.type.push(e.label.type)):(i.align=i.align||{},i.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(m("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ai(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({labels:r},t)}catch(e){return{}}},cullTextStyles(e,t){for(let i=0;i<t.length;i++){let r=t[i];e[r.text_settings_key][r.text].ref++}for(let t in e)for(let i in e[t])e[t][i].ref<1&&delete e[t][i];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,i){let r=new wi,n=Math.min(this.max_texture_size,2048),s=r.setTextureTextPositions(i,n),o=["labels",this.name,t,e,Ti,""].join("-");return Ti++,s=await r.rasterize(i,s,e,o,this.gl),s?{texts:i,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=Q.createPropertyCache(e.font.weight),e.font.fill=Q.createPropertyCache(e.font.fill||Kt.defaults.fill),e.font.alpha=Q.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Q.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Q.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=Q.createPropertyCache(e.font.background.color),e.font.background.alpha=Q.createPropertyCache(e.font.background.alpha),e.font.background.width=Q.createPropertyCache(e.font.background.width,Q.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=Q.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=Q.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=Q.createPropertyCache(e.font.size||Kt.defaults.size,wi.fontPixelSize,wi.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Q.createPropertyCache(e.font.stroke.width,Q.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=Q.createPropertyCache(e.font.background.stroke.width,Q.parsePositiveNumber)),e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parsePositiveNumber),e},computeTextLayout(e,t,i,r,n,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,i,r,n),null==i.repeat_distance&&(u.repeat_distance="point"===r.geometry?0:V.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof i.repeat_group?u.repeat_group=i.repeat_group(r):u.repeat_group=i.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=n.overzoom2,u.align=i.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Ei,Si,Ri,zi,Mi,Pi,Oi,Ni,Ci,Li,Ii,Fi,Di,Ui,ji,Bi,Gi=O(Si?Ei:(Si=1,Ei=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],f=t[11],p=t[12],_=t[13],m=t[14],g=t[15],y=i*a-r*o,b=i*l-n*o,v=i*u-s*o,x=r*l-n*a,w=r*u-s*a,A=n*u-s*l,T=h*_-c*p,k=h*m-d*p,E=h*g-f*p,S=c*m-d*_,R=c*g-f*_,z=d*g-f*m,M=y*z-b*R+v*S+x*E-w*k+A*T;return M?(M=1/M,e[0]=(a*z-l*R+u*S)*M,e[1]=(l*E-o*z-u*k)*M,e[2]=(o*R-a*E+u*T)*M,e[3]=(n*R-r*z-s*S)*M,e[4]=(i*z-n*E+s*k)*M,e[5]=(r*E-i*R-s*T)*M,e[6]=(_*A-m*w+g*x)*M,e[7]=(m*v-p*A-g*b)*M,e[8]=(p*w-_*v+g*y)*M,e):null})),Vi=O(zi?Ri:(zi=1,Ri=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=h*o-a*u,d=-h*s+a*l,f=u*s-o*l,p=i*c+r*d+n*f;return p?(p=1/p,e[0]=c*p,e[1]=(-h*r+n*u)*p,e[2]=(a*r-n*o)*p,e[3]=d*p,e[4]=(h*i-n*l)*p,e[5]=(-a*i+n*s)*p,e[6]=f*p,e[7]=(-u*i+r*l)*p,e[8]=(o*i-r*s)*p,e):null})),$i=O(Pi?Mi:(Pi=1,Mi=function(e,t,i){var r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],p=t[11],_=t[12],m=t[13],g=t[14],y=t[15],b=i[0],v=i[1],x=i[2],w=i[3];return e[0]=b*r+v*a+x*c+w*_,e[1]=b*n+v*l+x*d+w*m,e[2]=b*s+v*u+x*f+w*g,e[3]=b*o+v*h+x*p+w*y,b=i[4],v=i[5],x=i[6],w=i[7],e[4]=b*r+v*a+x*c+w*_,e[5]=b*n+v*l+x*d+w*m,e[6]=b*s+v*u+x*f+w*g,e[7]=b*o+v*h+x*p+w*y,b=i[8],v=i[9],x=i[10],w=i[11],e[8]=b*r+v*a+x*c+w*_,e[9]=b*n+v*l+x*d+w*m,e[10]=b*s+v*u+x*f+w*g,e[11]=b*o+v*h+x*p+w*y,b=i[12],v=i[13],x=i[14],w=i[15],e[12]=b*r+v*a+x*c+w*_,e[13]=b*n+v*l+x*d+w*m,e[14]=b*s+v*u+x*f+w*g,e[15]=b*o+v*h+x*p+w*y,e})),qi=O(Ni?Oi:(Ni=1,Oi=function(e,t,i){var r,n,s,o,a,l,u,h,c,d,f,p,_=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*_+t[4]*m+t[8]*g+t[12],e[13]=t[1]*_+t[5]*m+t[9]*g+t[13],e[14]=t[2]*_+t[6]*m+t[10]*g+t[14],e[15]=t[3]*_+t[7]*m+t[11]*g+t[15]):(r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],p=t[11],e[0]=r,e[1]=n,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=d,e[10]=f,e[11]=p,e[12]=r*_+a*m+c*g+t[12],e[13]=n*_+l*m+d*g+t[13],e[14]=s*_+u*m+f*g+t[14],e[15]=o*_+h*m+p*g+t[15]),e})),Wi=O(Li?Ci:(Li=1,Ci=function(e,t,i){var r=i[0],n=i[1],s=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Zi=O(Fi?Ii:(Fi=1,Ii=function(e,t,i,r,n){var s=1/Math.tan(t/2),o=1/(r-n);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+r)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*r*o,e[15]=0,e}));function Hi(){return Ui?Di:(Ui=1,Di=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Xi,Yi,Ji=function(){if(Bi)return ji;Bi=1;var e=Hi();return ji=function(t,i,r,n){var s,o,a,l,u,h,c,d,f,p,_=i[0],m=i[1],g=i[2],y=n[0],b=n[1],v=n[2],x=r[0],w=r[1],A=r[2];return Math.abs(_-x)<1e-6&&Math.abs(m-w)<1e-6&&Math.abs(g-A)<1e-6?e(t):(c=_-x,d=m-w,f=g-A,s=b*(f*=p=1/Math.sqrt(c*c+d*d+f*f))-v*(d*=p),o=v*(c*=p)-y*f,a=y*d-b*c,(p=Math.sqrt(s*s+o*o+a*a))?(s*=p=1/p,o*=p,a*=p):(s=0,o=0,a=0),l=d*a-f*o,u=f*s-c*a,h=c*o-d*s,(p=Math.sqrt(l*l+u*u+h*h))?(l*=p=1/p,u*=p,h*=p):(l=0,u=0,h=0),t[0]=s,t[1]=l,t[2]=c,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=h,t[10]=f,t[11]=0,t[12]=-(s*_+o*m+a*g),t[13]=-(l*_+u*m+h*g),t[14]=-(c*_+d*m+f*g),t[15]=1,t)}}(),Ki=O(Ji),Qi=O(Hi()),er=O(Yi?Xi:(Yi=1,Xi=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const tr={fromValues(e,t,i){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=i,r}},ir={normalFromMat4:Gi,invert:Vi},rr={multiply:$i,translate:qi,scale:Wi,perspective:Zi,lookAt:Ki,identity:Qi,copy:er};class nr{constructor(e,t,i={}){this.view=t,this.position=i.position,this.zoom=i.zoom}static create(e,t,i){switch(i.type){case"isometric":return new or(e,t,i);case"flat":return new ar(e,t,i);default:return new sr(e,t,i)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){rr.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),ir.normalFromMat4(e.normal32,e.model_view32),ir.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class sr extends nr{constructor(e,t,i={}){super(e,t,i),this.type="perspective",this.focal_length=i.focal_length,this.fov=i.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=i.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),U.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:i,fov:r}){return t?(i=2*t/e,r=2*Math.atan(1/i)):(i?r=2*Math.atan(1/i):r&&(r=r*Math.PI/180,i=1/Math.tan(r/2)),t=e/2*i),{view_height:e,height:t,focal_length:i,fov:r}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:i}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),r=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=r,rr.lookAt(this.view_matrix,tr.fromValues(r[0],r[1],0),tr.fromValues(r[0],r[1],-1),tr.fromValues(0,1,0)),rr.perspective(this.projection_matrix,i,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],rr.translate(this.projection_matrix,this.projection_matrix,tr.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),rr.translate(this.projection_matrix,this.projection_matrix,tr.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class or extends nr{constructor(e,t,i={}){super(e,t,i),this.type="isometric",this.axis=i.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),U.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,rr.identity(this.view_matrix),rr.translate(this.view_matrix,this.view_matrix,tr.fromValues(-e[0],-e[1],0)),rr.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,rr.scale(this.projection_matrix,this.projection_matrix,tr.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class ar extends or{constructor(e,t,i={}){super(e,t,i),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const lr=qt.PLACEMENT,ur=Object.create(Pe),hr="__shader_point";Object.assign(ur,ki),Object.assign(ur,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Pe.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===b.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==b.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===b.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===b.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n,s={};if(s.color=this.parseColor(t.color,i),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=Q.evalCachedProperty(t.alpha,i),this.hasSprites(s)){if(n=this.parseSprite(s,t,i),!n)return void m({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${s.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(i=>{i&&m("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});s.texcoords=n.texcoords}else if(t.sprite)return void m({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,s,n,i),t.outline&&(s.outline_width=Q.evalCachedProperty(t.outline.width,i)||Q.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,i)),s.outline_edge_pct=0,s.outline_width&&s.outline_color){let e=s.outline_width;s.size[0]+=e,s.size[1]+=e,s.outline_edge_pct=e/Math.min(s.size[0],s.size[1])*2,s.outline_alpha=Q.evalCachedProperty(t.outline.alpha,i)}s.size[0]=Math.min(s.size[0],256),s.size[1]=Math.min(s.size[1],256),s.placement=t.placement,s.placement_min_length_ratio=Q.evalCachedProperty(t.placement_min_length_ratio,i),s.placement===lr.SPACED&&t.placement_spacing&&(s.placement_spacing=Q.evalCachedProperty(t.placement_spacing,i)),s.angle=Q.evalProperty(t.angle,i)||0,s.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,i,r);let o=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,i,r);Array.isArray(o)&&(o=null,m({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),o&&(o.layout.parent=s,o.layout.priority=t.text.priority?Math.max(o.layout.priority,s.priority+.5):s.priority+.5,$t.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:i,style:s,text_feature:o},r),$t.addStyle(this.collision_group_points,r.id)},calcSize(e,t,i,r){if(t.size=e.size,t.size){if(t.size=Q.evalCachedPointSizeProperty(e.size,i,S.textures[t.texture],r),null==t.size)return void m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=i&&i.css_size||[16,16]},hasSprites:e=>e.texture&&S.textures[e.texture]&&S.textures[e.texture].sprites,getSpriteInfo(e,t){let i=S.textures[e.texture].sprites[t]&&S.getSpriteInfo(e.texture,t);return t&&!i?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(m("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):i&&(i.sprite=t),i},parseSprite(e,t,i){let r=Q.evalProperty(t.sprite,i);return this.getSpriteInfo(e,r)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return m("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let i=[],r=[];t.forEach(e=>{let t=e.style,n=e.feature,s=n.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:n,draw:e.draw,context:e.context,style:t,label:a};if(r.push(l),e.text_feature){let t={feature:n,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};i.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:n,texts:s,textures:o}]=await Promise.all([$t.collide(r,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Pe.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,i)]);n&&s&&n.forEach(e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text],r=this.feature_style;r.label=e.label,r.linked=e.linked,r.size=i.size.logical_size,r.texcoords=i.align[e.label.align].texcoords,r.label_texture=o[i.align[e.label.align].texture_id],r.blend_order=e.draw.blend_order,Pe.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Pe.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parsePositiveNumber)),e.z=Q.createPropertyCache(e.z,Q.parseUnits);try{e.size=Q.createPointSizePropertyCache(e.size,e.texture)}catch(t){return m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parseNumber),e.placement=lr[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=lr.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=Q.createPropertyCache(e.placement_spacing,Q.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=Q.createPropertyCache(e.placement_min_length_ratio,Q.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,i,r,n){let s=e||{};s.id=t,s.units_per_pixel=n.units_per_pixel||1,s.collide=!1!==i.collide,s.anchor=i.anchor,s.offset=Q.evalCachedProperty(i.offset,r)||Q.zeroPair,s.buffer=Q.evalCachedProperty(i.buffer,r)||Q.zeroPair,s.repeat_distance=Q.evalCachedProperty(i.repeat_distance,r),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof i.repeat_group?s.repeat_group=i.repeat_group(r):s.repeat_group=i.repeat_group||r.layer);let o=i.priority;return null!=o?"function"==typeof o&&(o=o(r)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let i=[];for(let r=0;r<t.length;r++){let n=t[r],s=this.texts[e.id][n.text_settings_key][n.text].size.collision_size;n.label=new qt(n.point_label.position,s,n.layout),i.push(n)}return i},buildLabels(e,t,i){let r=[];if("Point"===t.type)r.push(new qt(t.coordinates,e,i,i.angle));else if("MultiPoint"===t.type){let n=t.coordinates;for(let t=0;t<n.length;++t){let s=n[t];r.push(new qt(s,e,i,i.angle))}}else if("LineString"===t.type){let n=Zt(t.coordinates,e,i);for(let e=0;e<n.length;++e)r.push(n[e])}else if("MultiLineString"===t.type){let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Zt(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e])}}else if("Polygon"===t.type)if(i.placement===lr.CENTROID){let n=V.centroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle))}else{let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Zt(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e])}}else if("MultiPolygon"===t.type)if(i.placement===lr.CENTROID){let n=V.multiCentroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle))}else{let n=t.coordinates;for(let t=0;t<n.length;t++){let s=n[t];for(let t=0;t<s.length;t++){let n=Zt(s[t],e,i);for(let e=0;e<n.length;++e)r.push(n[e])}}}return r},makeVertexTemplate(e,t,i=!0){let r=0;this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=0,this.vertex_template[r++]=0;const n=e.color||Q.defaults.color;if(this.vertex_template[r++]=255*n[0],this.vertex_template[r++]=255*n[1],this.vertex_template[r++]=255*n[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:n[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||Q.defaults.outline.color;this.vertex_template[r++]=255*t[0],this.vertex_template[r++]=255*t[1],this.vertex_template[r++]=255*t[2],this.vertex_template[r++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[r++]=e.outline_edge_pct||Q.defaults.outline.width}return i&&this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildQuad:(e,t,i,r,n,s,o,a,l,u,h)=>t[0]<=0||t[1]<=0?0:function(e,t,i,r,n,s,o,a,l,u,h,c){const d=128*n[0],f=128*n[1];kt[0]=-d,kt[1]=-f,kt[2]=d,kt[3]=f;const p=h||je,_=t.vertex_elements;let m=t.vertex_count;for(let n=0;n<4;n++)i[r.a_position+0]=e[0],i[r.a_position+1]=e[1],i[r.a_shape+0]=kt[At[n]],i[r.a_shape+1]=kt[Tt[n]],i[r.a_shape+2]=l,i[r.a_offset+0]=s[0],i[r.a_offset+1]=s[1],r.a_texcoord&&(i[r.a_texcoord+0]=65535*p[At[n]],i[r.a_texcoord+1]=65535*p[Tt[n]]),c&&(i[r.a_pre_angles+0]=xt*a[0],i[r.a_pre_angles+1]=xt*a[1],i[r.a_pre_angles+2]=xt*a[2],i[r.a_pre_angles+3]=xt*a[3],i[r.a_angles+0]=wt*u[0],i[r.a_angles+1]=wt*u[1],i[r.a_angles+2]=wt*u[2],i[r.a_angles+3]=wt*u[3],i[r.a_offsets+0]=64*o[0],i[r.a_offsets+1]=64*o[1],i[r.a_offsets+2]=64*o[2],i[r.a_offsets+3]=64*o[3]),t.addVertex(i);return _.push(m+0),_.push(m+1),_.push(m+2),_.push(m+2),_.push(m+3),_.push(m+0),2}(e,u,h,u.vertex_layout.index,t,s,o,n,4096*i,r,a,l),build(e,t){let i=e.label;return"curved"===i.type?this.buildCurvedLabel(i,e,t):this.buildStraightLabel(i,e,t)},buildStraightLabel(e,t,i){let r,n,s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(r=t.size[e.type],n=t.texcoords[e.type].texcoord):(r=t.size,n=t.texcoords),s.uniforms=s.uniforms||{},t.label_texture?(s.uniforms.u_texture=t.label_texture,s.uniforms.u_point_type=2,s.uniforms.u_apply_color_blocks=!1):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=!0):(s.uniforms.u_texture=S.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,r,e.angle,null,null,a,null,n,!1,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,i),l},buildCurvedLabel(e,t,i){let r,n,s=0;for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords_stroke[o];t.label_texture=t.label_textures[o],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(h,a,e.angle,c,f,u,d,l,!0,r.vertex_data,n);s+=p;const _=t.linked&&t.linked.label.id;this.trackLabel(e,_,r,p,i)}for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords[e.type][o].texcoord;t.label_texture=t.label_textures[o],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(h,a,e.angle,c,f,u,d,l,!0,r.vertex_data,n);s+=p;const _=t.linked&&t.linked.label.id;this.trackLabel(e,_,r,p,i)}return s},trackLabel(e,t,i,r){if(e.layout.collide||e.may_repeat_across_tiles){i.labels=i.labels||{},i.labels[e.id]=i.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const n=2*r,s=i.vertex_data.offset-i.vertex_data.stride*n;i.labels[e.id].ranges.push([s,n])}},buildLines(e,t,i){return this.build(t,i)},buildPoints(e,t,i){return this.build(t,i)},buildPolygons(e,t,i){return this.build(t,i)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new De(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hr,i=t+"/"+e.blend_order;return null==this.variants[i]&&(this.variants[i]={key:i,selection:1,shader_point:t===hr,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[i]},makeMesh(e,t,i={}){return i=Object.assign({},i,{fade_in_time:this.fade_in_time}),Pe.makeMesh.call(this,e,t,i)}});const cr=[0,.33,.66,.99];let dr=function(e,t,i,r){const n=[{type:"straight",tolerance:r.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<n.length;s++){let o,a=n[s];if("straight"===a.type?o=new pr(t,i,r,a.tolerance):"curved"===a.type&&!r.no_curving&&i.length>2&&(o=new _r(e,i,r)),o&&!o.throw_away)return o}return!1};class fr{constructor(e){this.id=jt.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],i=0,r=0,n=0,s=t,o=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],h=ye.length(ye.sub(l,u));l[0]>u[0]?1===n?(t.push(l),i+=h,i>r&&(s=t,r=i,o=!1)):(t=[u,l],i=h,i>r&&(s=t,r=i,o=!1),n=1):l[0]<u[0]?-1===n?(t.unshift(l),i+=h,i>r&&(s=t,r=i,o=!0)):(t=[l,u],i=h,i>r&&(s=t,r=i,o=!0),n=-1):(-1===n?t.unshift(l):(t.push(l),n=1),i+=h,i>r&&(s=t,r=i,o=-1===n))}return[s,o]}discard(e,t=null){if(this.throw_away)return!0;for(let i=0;i<this.obbs.length;i++){let r={aabb:this.aabbs[i],obb:this.obbs[i]};if(jt.prototype.occluded.call(r,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!jt.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,i,r,n,s,o){let a=e[0],l=e[1];return!s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,n))[0]*o,l-=s[1]*o),new Ut(a,l,-r,t,i)}}class pr extends fr{constructor(e,t,i,r){super(i),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,i,r)}fit(e,t,i,r){let n,s=this.unit_scale;[t,n]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(e[1]-i.vertical_buffer),n&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let o=yr(t),a=e[0]*s;for(let n=0;n<t.length-1;n++){let s,l=t[n],u=0,h=0,c=n+1;for(;c<t.length;){let d=t[c-1],f=t[c],p=gr(d,f);if(c!==n+1&&(u+=br(p,s)),Math.abs(u)>.1)break;if(h+=o[c-1],mr(h,a)<r){let t=ye.mult(ye.add(l,f),.5);return this.angle=-p,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof i.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}s=p,c++}}return!1}updateBBoxes(e,t,i,r,n){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*jt.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*jt.epsilon,l=fr.createOBB(e,o,a,i,r,n,s),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class _r extends fr{constructor(e,t,i){super(i),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,i)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,i){let r,n=this.unit_scale,s=Math.max(...e.map(e=>e[1])),o=s*n;[t,r]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(s-i.vertical_buffer),r&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let a=yr(t),l=e.map(e=>e[0]*n),u=a.reduce((e,t)=>e+t,0),h=l.reduce((e,t)=>e+t,0);if(h>u)return!1;let c=t.length-1;if(c-0<2)return!1;let d=_r.curvaturePlacement(t,u,a,h,0,c),f=t[d];if(-1===d||c-d<2)return!1;this.position=f;for(var p=0;p<l.length;p++){this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var _=0;_<cr.length;_++){let e=cr[_],[i,r]=_r.scaleLine(e,t);f=i[d];let{positions:s,offsets:a,angles:u,pre_angles:h}=_r.placeAtIndex(d,i,r,l),c=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/n);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<s.length;e++){let t=s[e],i=h[e],r=l[e],a=i+u[e],c=this.angle,d=fr.createOBB(t,r,o,a,c,this.offset,n),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f)}}this.offsets[p].push(c[p]),this.angles[p].push(u[p]),this.pre_angles[p].push(h[p])}}return!0}static curvaturePlacement(e,t,i,r,n,s){n=n||0,s=s||e.length-1;var o=[];for(let t=n+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],h=ye.perp(l,a),c=ye.perp(u,l),d=ye.angleBetween(h,c);d>1&&(d=1/0),o.push(d)}o.push(1/0);var f=[],p=[],_=n,m=0;for(let e=0;e<n;e++)m+=i[e];for(;m+r<t;){for(var g=m+r,y=m,b=_,v=0;b<s&&y+i[b]<g&&(v+=o[b])!==1/0;)y+=i[b],b++;if(0===v)return _;var x=v/(b-_);f.push(v),p.push(x),m+=i[_],_++}if(0===f.length)return-1;var w=Math.min.apply(null,f),A=p[f.indexOf(w)];return w<1.3&&A<.4?f.indexOf(w):-1}static scaleLine(e,t){var i=[t[0]],r=[];return t.forEach((n,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);i.push(ye.add(i[s],a)),r.push(ye.length(a))}}),[i,r]}static placeAtIndex(e,t,i,r){let n=t[e],[s,o]=_r.getIndicesAndOffsets(e,i,r),a=_r.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,h]=_r.getAnglesFromIndicesAndOffsets(n,s,t,a);return{positions:a,offsets:l,angles:u,pre_angles:h}}static getIndicesAndOffsets(e,t,i){let r=i.length,n=[],s=[],o=0,a=0,l=0;for(;o<r;){let u=i[o];for(;o<r&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),n.push(e),a+=u,o++,u=i[o]}l+=t[e],e++}return[n,s]}static getPositionsFromIndicesAndOffsets(e,t,i){let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=i[n],a=gr(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);r.push(u)}return r}static getAnglesFromIndicesAndOffsets(e,t,i,r){let n=[],s=[],o=[];for(let a=0;a<r.length;a++){let l=r[a],u=t[a],h=ye.sub(l,e),c=-ye.angle(h),d=-gr(i[u],i[u+1])-c;if(a>0){let e=n[a-1],t=s[a-1];Math.abs(c-e)>Math.PI&&(c+=c>e?-2*Math.PI:2*Math.PI),Math.abs(t-d)>Math.PI&&(d+=d>t?-2*Math.PI:2*Math.PI)}n.push(c),s.push(d),o.push(h)}return[o,n,s]}}function mr(e,t){return t/e}function gr(e,t){let i=ye.sub(t,e);return ye.angle(i)}function yr(e){let t=[];for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1],s=Math.hypot(r[0]-n[0],r[1]-n[1]);t.push(s)}return t}function br(e,t){let i,r;for(e>t?(i=t,r=e):(i=e,r=t);r-i>Math.PI;)i+=2*Math.PI;return Math.abs(r-i)}let vr=Object.create(ur);Object.assign(vr,{name:"text",super:ur,built_in:!0,init(e={}){Pe.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let i=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[i++]=0;return this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n=e.geometry.type;t.can_articulate="LineString"===n||"MultiLineString"===n,t.supersample_text="LineString"===n||"MultiLineString"===n;let s=this.parseTextFeature(e,t,i,r);s&&(s instanceof Array?s.forEach(t=>{t.feature=e,t.context=i,t.layout.vertex=!1,this.queueFeature(t,r)}):(s.feature=e,s.context=i,s.layout.vertex=!1,this.queueFeature(s,r)),$t.addStyle(this.name,r.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:i,texts:r,textures:n}=await this.collideAndRenderTextLabels(e,this.name,t);i&&r&&(this.texts[e.id]=r,i.forEach(t=>{let i=t.text_settings_key,r=this.texts[e.id][i]&&this.texts[e.id][i][t.text],s=this.feature_style;s.label=t.label,r.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=r.size.logical_size,s.texcoords.straight=r.texcoords.straight,s.label_texture=n[r.texcoords.straight.texture_id]):(s.size.curved=r.segment_sizes.map(function(e){return e.logical_size}),s.texcoords_stroke=r.texcoords_stroke,s.texcoords.curved=r.texcoords.curved,s.label_textures=r.texcoords.curved.map(e=>n[e.texture_id]))):(s.size=r.size.logical_size,s.texcoords=r.align[t.label.align].texcoords,s.label_texture=n[r.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Pe.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const s=await Pe.endData.call(this,e);if(s){n&&n.length&&s.textures.push(...n);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=!0}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let i=[];for(let n=0;n<t.length;n++){let s,o=t[n],a=this.texts[e.id][o.text_settings_key][o.text];if(o.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var r=a.segment_sizes.map(e=>e.collision_size);o.layout.no_curving=a.no_curving,s=this.buildLabels(r,o.feature.geometry,o.layout,a.size.collision_size)}else s=this.buildLabels(a.size.collision_size,o.feature.geometry,o.layout);for(let e=0;e<s.length;e++){let t=Object.create(o);t.label=s[e],i.push(t)}}return i},buildLabels(e,t,i,r){let n=[];if("LineString"===t.type)Array.prototype.push.apply(n,this.buildLineLabels(t.coordinates,e,i,r));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(n,this.buildLineLabels(s[t],e,i,r))}else if("Point"===t.type)n.push(new qt(t.coordinates,e,i));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t)n.push(new qt(r[t],e,i))}else if("Polygon"===t.type){let r=V.centroid(t.coordinates);r&&n.push(new qt(r,e,i))}else if("MultiPolygon"===t.type){let r=V.multiCentroid(t.coordinates);r&&n.push(new qt(r,e,i))}return n},buildLineLabels(e,t,i,r){let n=[],s=Math.min(i.subdiv,e.length-1);if(s>1){let o=(e.length-1)/s;for(let a=0;a<s;a++){let s=Math.floor(a*o),l=Math.floor((a+1)*o)+1,u=e.slice(s,l),h=dr(t,r,u,i);h&&n.push(h)}}if(n.length<s){let s=dr(t,r,e,i);s&&n.push(s)}return n},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:!1},{name:"a_angles",size:4,type:fe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new De(t)}return this.vertex_layouts[e.shader_point]}}),vr.texture_id=0;let xr=Object.create(et);function wr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Ar(e){return null!=e}function Tr(e){return"("+e+")"}function kr(e){return"string"==typeof e?'"'+e+'"':e}function Er(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function Sr(e,t){return Tr(kr(t)+" === "+Er(e))}function Rr(e,t){return Tr(`${"["+t.map(kr).join(",")+"]"}.indexOf(${Er(e)}) > -1`)}function zr(e,t){return Tr(e.filter(Ar).map(function(e){return Tr(e.join(" && "))}).join(" "+t+" "))}function Mr(e,t,i){return t&&t.length>0?zr(t.map(function(e){return Fr(e,i)}),"||"):"true"}function Pr(e,t,i){return t&&t.length>0?zr(t.map(function(e){return Fr(e,i)}),"&&"):"true"}function Or(e,t,i){return"!"+Tr(Fr(t,i).join(" && "))}function Nr(e,t,i){return"!"+Tr(Mr(0,t,i))}function Cr(e,t){return Tr(Er(e)+(t?" != ":" == ")+"null")}function Lr(e,t,i){var r=[],n=i&&"function"==typeof i.rangeTransform&&i.rangeTransform;if(t.max){var s=n?n(t.max):t.max;r.push(Er(e)+" < "+s)}if(t.min){var o=n?o=n(t.min):t.min;r.push(Er(e)+" >= "+o)}return Tr(r.join(" && "))}function Ir(e,t){let i=[];if(t.includes_any){const r="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(kr).join(",")+"]";i.push(`${Er(e)} != null && ${r}.some(function(v) { return ${Er(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const r="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(kr).join(",")+"]";i.push(`${Er(e)} != null && ${r}.every(function(v) { return ${Er(e)}.indexOf(v) > -1 })`)}return Tr(i.join(" && "))}function Fr(e,t){var i=[];if("function"==typeof e)return[Tr(e.toString()+"(context)")];if(Array.isArray(e))return[Mr(0,e,t)];if(null==e)return["true"];for(var r=Object.keys(e),n=0;n<r.length;n++){var s=r[n],o=e[s],a=typeof o;if("string"===a||"number"===a)i.push(Sr(s,o));else if("boolean"===a)i.push(Cr(s,o));else if("not"===s)i.push(Or(0,o,t));else if("any"===s)i.push(Mr(0,o,t));else if("all"===s)i.push(Pr(0,o,t));else if("none"===s)i.push(Nr(0,o,t));else if(Array.isArray(o))i.push(Rr(s,o));else if("object"===a&&null!=o)o.max||o.min?i.push(Lr(s,o,t)):(o.includes_any||o.includes_all)&&i.push(Ir(s,o));else{if(null!=o)throw new Error("Unknown Query syntax: "+o);i.push(" true ")}}return 0===r.length?["true"]:i}function Dr(e,t){return null==e?function(){return!0}:new Function("context","return "+Tr(Fr(e,t).join(" && "))+";")}Object.assign(xr,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||Q.defaults.color,this.super._preprocess.apply(this,arguments)}});const Ur=["filter","draw","visible","enabled","data","exclusive","priority"];let jr={};function Br(e,t){let i,r=0;for(let t=0;t<e.length;t++)e[t].length>r&&(r=e[t].length);if(0===r)return null;let n={visible:!0};for(let s=0;s<r;s++)i=[],e.forEach(e=>{e[s]&&e[s][t]&&-1===i.indexOf(e[s][t])&&i.push(e[s][t])}),0!==i.length&&G(n,...i);return!1===n.visible?null:n}const Gr=["any","all","not","none"];class Vr{constructor({layer:e,name:t,parent:i,draw:r,visible:n,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=Vr.id++,this.config_data=e.data,this.parent=i,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=r,this.filter=o,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,s=void 0===s?n:s,this.enabled=!1!==s,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,m("warn",t),delete this.draw[e]}}build(){m("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=H(this.draw,Q.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let i=e.parent.calculatedDraw||[];t.push(...i)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=H(this.filter,Q.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void m("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=Dr(this.filter,Wr):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,m("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,i=e.max||V.max_style_zoom;for(let e=t;e<i;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Gr.indexOf(e)){let t=this.filter[e],i=typeof t,r=Array.isArray(t);if(!r&&"string"!==i&&"number"!==i)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),r?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,r?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let i=this.feature_prop_matches[t],r=e.feature.properties[i[0]];if(null==r||-1===i[1].indexOf(r))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let i=this.context_prop_matches[t],r=e[i[0]];if(null==r||-1===i[1].indexOf(r))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let i=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;i+=`failed with error '${t.message}', stack trace: ${t.stack}`,m("error",i,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,i){for(let r in t){let n=t[r];if("object"!=typeof n||Array.isArray(n)){let t=`Layer value must be an object: cannot create layer '${r}: ${JSON.stringify(n)}'`;t+=`, under parent layer '${e.full_name}'.`,i[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),m("warn",t)}else Hr(r,n,e,i)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const i=e.exclusive?1:-1;return e.priority>t.priority?i:e.priority<t.priority?-i:e.full_name<t.full_name?i:e.full_name>t.full_name?-i:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}Vr.id=0;class $r extends Vr{constructor(e){super(e),this.is_leaf=!0}}class qr extends Vr{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],i=[];if(Xr(e,[this],t,i),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],i=1;i<e.length;i++)t+="/"+e[i];return t}return e[0]}(i);if(void 0===jr[e]){let i=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),r={};for(let e=0;e<i.length;e++){let t=i[e];if(t)for(let e=0;e<t.length;e++){let i=t[e];for(let e in i)r[e]=!0}}for(let n in r)jr[e]=jr[e]||{},jr[e][n]=Br(i,n),jr[e][n]?(jr[e][n].key=e+"/"+n,jr[e][n].layers=t.map(e=>e&&e.full_name),jr[e][n].group=n):delete jr[e][n];jr[e]&&0===Object.keys(jr[e]).length&&(jr[e]=null)}return jr[e]}}}const Wr={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Zr(e){return Ur.indexOf(e)>-1}function Hr(e,t,i,r){let n={name:e,layer:t=null==t?{}:t,parent:i,styles:r},[s,o]=function(e){let t={},i={};for(let r in e)Zr(r)?t[r]=e[r]:i[r]=e[r];return[t,i]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=i?$r:qr;let h=new u(Object.assign(n,s));return h.enabled&&(i&&i.addLayer(h),h.children_to_parse=a?null:o),h}function Xr(e,t,i,r){let n=!1,s=!1;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(n=!0,i.push(a),r.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(n=!0,s=Xr(e,a.layers,i,r),s||(i.push(a),r.push(a.id)),a.exclusive))break}return n}}function Yr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Jr(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Yr(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}let Kr=0,Qr=0;class en{constructor({coords:e,style_z:t,source:i,workers:r,view:n}){this.id=Kr++,this.view=n,this.source=i,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=Ee.normalizedCoord(e,this.source),this.key=Ee.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=V.metersForTile(this.coords),this.max=V.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=V.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=V.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=V.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(r)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){T.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),en.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:i,styles:r,global:n}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,$t.startTile(e.id,{apply_repeat_groups:!0});for(let t in i){let o=i[t];if(!o||!o.config_data){m("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(o.config_data.source!==e.source)continue;let a=en.getDataForSource(s,o.config_data,t);for(let i=0;i<a.length;i++){let s=a[i],l=s.geom;if(l)for(let i=0;i<l.features.length;i++){let a=l.features[i];if(null==a.geometry)continue;let u=Q.getFeatureParseContext(a,e,n);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let h=o.buildDrawGroups(u,!0);if(h){for(let e in h){let i=h[e],n=i.style||e,s=r[n];s?(i=s.preprocess(i),null!=i&&!1!==i.visible&&(u.layers=i.layers,s.addFeature(a,i,u))):m("warn",`Style '${n}' not found, skipping layer '${t}':`,i,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,r).map(e=>r[e]);en.buildStyleGroups(e,o,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let i=[];for(let r in t)t[r].hasDataForTile(e)&&i.push(r);return i}static buildStyleGroups(e,t,i,r){const n=t.reduce((e,t)=>{const i=r(t);return e[i]=e[i]||[],e[i].push(t),e},{});if(0===Object.keys(n).length)return a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:en.slice(e),progress:{start:!0,done:!0}})),void $t.resetTile(e.id);const s={};for(const t in n)en.buildStyleGroup({group_name:t,groups:n,tile:e,progress:s,scene_id:i})}static async buildStyleGroup({group_name:e,groups:t,tile:i,progress:r,scene_id:n}){const s=t[e],o={};try{await Promise.all(s.map(async function(e){const t=await e.endData(i);t&&(o[e.name]=t)})),m("trace",`Finished style group '${e}' for tile ${i.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(r.done=!0),a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:Jr(Jr({},en.slice(i)),{},{mesh_data:o}),progress:r})),r.done&&$t.resetTile(i.id)}catch(t){m("error",`Error for style group '${e}' for tile ${i.key}`,t&&t.stack||t)}}static getDataForSource(e,t,i){var r=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&m({level:"warn",once:!0},`Layer ${i} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)r.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?r.push({geom:e.layers._default}):!t.layer&&i?r.push({layer:i,geom:e.layers[i]}):"string"==typeof t.layer?r.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{r.push({layer:t,geom:e.layers[t]})});return r}buildMeshes(e,t){if(this.error)return;this.build_id=Qr++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let i={},r=this.mesh_data;if(r)for(let t in r){for(let n in r[t].meshes){let s=r[t].meshes[n];if(s.vertex_data){if(!e[t]){m("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let n=Object.assign({},r[t]);n.uniforms=Object.assign({},n.uniforms,s.uniforms),n.variant=s.variant,s.labels&&(n.retain=!0);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,n);o.variant=n.variant,o.labels=s.labels,i[t]=i[t]||[],i[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=i[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count}}i[t]&&i[t].sort((e,t)=>{let i=e.variant.mesh_order,r=t.variant.mesh_order;return null==i?1:null==r||i<r?-1:1})}delete this.mesh_data;for(let t in i)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=i[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=i[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(T.removeForTile(e.id),$t.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let i=e.mesh_data[t].textures;i&&i.forEach(t=>{let i=S.textures[t];i&&(m("trace",`releasing texture ${t} for tile ${e.key}`),i.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},i){i.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),i.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),rr.identity(e),rr.translate(e,e,tr.fromValues(this.min.x,this.min.y,0)),rr.scale(e,e,tr.fromValues(this.span.x/V.tile_scale,this.span.y/V.tile_scale,1)),rr.copy(t,e),i.uniform("Matrix4fv","u_model",t),i.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let i=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&i.push(...t);var r={};for(let t=0;t<i.length;t++){const n=i[t];r[n]=e[n]}return r}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=G(this.debug,e.debug),this}printDebug(e){const t=["layers"];let i={};for(let e in this.debug)-1===t.indexOf(e)&&(i[e]=this.debug[e]);m("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(i)} ]`)}}function tn(e,t){for(let i in e){let r=e[i];Oe(t,i,r.features,r.geoms,r.styles,r.base),r.layers&&(t[i].layers=t[i].layers||{},tn(r.layers,t[i].layers))}}en.coord_children={};var rn,nn,sn,on={};var an,ln,un,hn,cn,dn,fn,pn,_n,mn=function(){if(sn)return nn;sn=1,nn=t;var e=(rn||(rn=1,on.read=function(e,t,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=i?n-1:0,d=i?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)},on.write=function(e,t,i,r,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,p=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[i+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[i+f]=255&o,f+=p,o/=256,u-=8);e[i+f-p]|=128*_}),on);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i;function n(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function a(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function l(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function u(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function h(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function c(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function d(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function f(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function _(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function m(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,s=this.pos;this.type=7&r,e(n,t,this),this.pos===s&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=m(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=m(this.buf,this.pos)+m(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,i){for(var r="",n=t;n<i;){var s,o,a,l=e[n],u=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(u=l):2===h?128==(192&(s=e[n+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===h?(s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(s=e[n+1],o=e[n+2],a=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=h}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var i=n(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var i=7&e;if(i===t.Varint)for(;this.buf[this.pos++]>127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,s=0;s<t.length;s++){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){r>56319||s+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&o(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&o(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,c,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,_,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},nn}(),gn=O(mn),yn={};function bn(){if(hn)return un;hn=1;var e=function(){if(ln)return an;function e(e,t){this.x=e,this.y=t}return ln=1,an=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),s=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},an}();function t(e,t,r,n,s){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=s,e.readFields(i,this,t)}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function r(e){for(var t,i,r=0,n=0,s=e.length,o=s-1;n<s;o=n++)t=e[n],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}return un=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var i,r=t.readVarint()+t.pos,n=1,s=0,o=0,a=0,l=[];t.pos<r;){if(!s){var u=t.readVarint();n=7&u,s=u>>3}if(s--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(o,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var h=e.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<o&&(o=n),n>a&&(a=n),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,u]},t.prototype.toGeoJSON=function(e,i,n){var s,o,a=this.extent*Math.pow(2,n),l=this.extent*e,u=this.extent*i,h=this.loadGeometry(),c=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var i=e[t],r=180-360*(i.y+u)/a;e[t]=[360*(i.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(s=0;s<h.length;s++)f[s]=h[s][0];d(h=f);break;case 2:for(s=0;s<h.length;s++)d(h[s]);break;case 3:for(h=function(e){var t=e.length;if(t<=1)return[e];for(var i,n,s=[],o=0;o<t;o++){var a=r(e[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&s.push(i),i=[e[o]]):i.push(e[o]))}return i&&s.push(i),s}(h),s=0;s<h.length;s++)for(o=0;o<h[s].length;o++)d(h[s][o])}1===h.length?h=h[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:h},properties:this.properties};return"id"in this&&(p.id=this.id),p},un}function vn(){if(dn)return cn;dn=1;var e=bn();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(i,this,t),this.length=this._features.length}function i(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return cn=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},cn}var xn=(_n||(_n=1,yn.VectorTile=function(){if(pn)return fn;pn=1;var e=vn();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return fn=function(e,i){this.layers=e.readFields(t,{},i)},fn}(),yn.VectorTileFeature=bn(),yn.VectorTileLayer=vn()),yn);const wn=["{","["];class An extends ke{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&m({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,i){var r=new Uint8Array(i),n=new gn(r);if(t.data=new xn.VectorTile(n),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const i={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,i)}delete t.data}toGeoJSON(e){var t={};for(var i in e.layers){for(var r=e.layers[i],n=V.tile_scale/r.extent,s={type:"FeatureCollection",features:[]},o=0;o<r.length;o++){var a=r.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,h=a.loadGeometry(),c=0;c<h.length;c++)for(var d=h[c],f=0;f<d.length;f++)d[f]=[d[f].x*n,d[f].y*n];u.coordinates=h,"Point"===xn.VectorTileFeature.types[a.type]?1===h.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xn.VectorTileFeature.types[a.type]?1===h.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xn.VectorTileFeature.types[a.type]&&(u=Tn(u)),s.features.push(l)}t[i]=s}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const i in t)if(wn.indexOf(t[i][0])>-1)try{t[i]=JSON.parse(t[i])}catch(e){}}}}function Tn(e){let t,i=[],r=[];for(let n=0;n<e.coordinates.length;n++){let s=e.coordinates[n],o=V.ringWinding(s);null!=o&&(t=t||o,o===t&&r.length>0&&(i.push(r),r=[]),r.push(s))}return r.length>0&&i.push(r),1===i.length?(e.type="Polygon",e.coordinates=i[0]):i.length>1?(e.type="MultiPolygon",e.coordinates=i):e=null,e}function kn(e,t,i,r){for(var n,s=r,o=i-t>>1,a=i-t,l=e[t],u=e[t+1],h=e[i],c=e[i+1],d=t+3;d<i;d+=3){var f=En(e[d],e[d+1],l,u,h,c);if(f>s)n=d,s=f;else if(f===s){var p=Math.abs(d-o);p<a&&(n=d,a=p)}}s>r&&(n-t>3&&kn(e,t,n,r),e[n+2]=s,i-n>3&&kn(e,n,i,r))}function En(e,t,i,r,n,s){var o=n-i,a=s-r;if(0!==o||0!==a){var l=((e-i)*o+(t-r)*a)/(o*o+a*a);l>1?(i=n,r=s):l>0&&(i+=o*l,r+=a*l)}return(o=e-i)*o+(a=t-r)*a}function Sn(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)Rn(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)Rn(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)Rn(e,t[r][n])}(n),n}function Rn(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function zn(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===s)Mn(n,a);else if("MultiPoint"===s)for(var u=0;u<n.length;u++)Mn(n[u],a);else if("LineString"===s)Pn(n,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<n.length;u++)a=[],Pn(n[u],a,o,!1),e.push(Sn(l,"LineString",a,t.properties));return}On(n,a,o,!1)}else if("Polygon"===s)On(n,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)zn(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var h=[];On(n[u],h,o,!0),a.push(h)}}e.push(Sn(l,s,a,t.properties))}}function Mn(e,t){t.push(Nn(e[0])),t.push(Cn(e[1])),t.push(0)}function Pn(e,t,i,r){for(var n,s,o=0,a=0;a<e.length;a++){var l=Nn(e[a][0]),u=Cn(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=r?(n*u-l*s)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-s,2))),n=l,s=u}var h=t.length-3;t[2]=1,kn(t,0,h,i),t[h+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function On(e,t,i,r){for(var n=0;n<e.length;n++){var s=[];Pn(e[n],s,i,r),t.push(s)}}function Nn(e){return e/360+.5}function Cn(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function Ln(e,t,i,r,n,s,o,a){if(r/=t,s>=(i/=t)&&o<r)return e;if(o<i||s>=r)return null;for(var l=[],u=0;u<e.length;u++){var h=e[u],c=h.geometry,d=h.type,f=0===n?h.minX:h.minY,p=0===n?h.maxX:h.maxY;if(f>=i&&p<r)l.push(h);else if(!(p<i||f>=r)){var _=[];if("Point"===d||"MultiPoint"===d)In(c,_,i,r,n);else if("LineString"===d)Fn(c,_,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===d)Un(c,_,i,r,n,!1);else if("Polygon"===d)Un(c,_,i,r,n,!0);else if("MultiPolygon"===d)for(var m=0;m<c.length;m++){var g=[];Un(c[m],g,i,r,n,!0),g.length&&_.push(g)}if(_.length){if(a.lineMetrics&&"LineString"===d){for(m=0;m<_.length;m++)l.push(Sn(h.id,d,_[m],h.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===_.length?(d="LineString",_=_[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===_.length?"Point":"MultiPoint"),l.push(Sn(h.id,d,_,h.tags))}}}return l.length?l:null}function In(e,t,i,r,n){for(var s=0;s<e.length;s+=3){var o=e[s+n];o>=i&&o<=r&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function Fn(e,t,i,r,n,s,o){for(var a,l,u=Dn(e),h=0===n?Bn:Gn,c=e.start,d=0;d<e.length-3;d+=3){var f=e[d],p=e[d+1],_=e[d+2],m=e[d+3],g=e[d+4],y=0===n?f:p,b=0===n?m:g,v=!1;o&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(p-g,2))),y<i?b>i&&(l=h(u,f,p,m,g,i),o&&(u.start=c+a*l)):y>r?b<r&&(l=h(u,f,p,m,g,r),o&&(u.start=c+a*l)):jn(u,f,p,_),b<i&&y>=i&&(l=h(u,f,p,m,g,i),v=!0),b>r&&y<=r&&(l=h(u,f,p,m,g,r),v=!0),!s&&v&&(o&&(u.end=c+a*l),t.push(u),u=Dn(e)),o&&(c+=a)}var x=e.length-3;f=e[x],p=e[x+1],_=e[x+2],(y=0===n?f:p)>=i&&y<=r&&jn(u,f,p,_),x=u.length-3,s&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&jn(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Dn(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Un(e,t,i,r,n,s){for(var o=0;o<e.length;o++)Fn(e[o],t,i,r,n,s,!1)}function jn(e,t,i,r){e.push(t),e.push(i),e.push(r)}function Bn(e,t,i,r,n,s){var o=(s-t)/(r-t);return e.push(s),e.push(i+(n-i)*o),e.push(1),o}function Gn(e,t,i,r,n,s){var o=(s-i)/(n-i);return e.push(t+(r-t)*o),e.push(s),e.push(1),o}function Vn(e,t){for(var i=[],r=0;r<e.length;r++){var n,s=e[r],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=$n(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var a=0;a<s.geometry.length;a++)n.push($n(s.geometry[a],t))}else if("MultiPolygon"===o)for(n=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push($n(s.geometry[a][u],t));n.push(l)}i.push(Sn(s.id,o,n,s.tags))}return i}function $n(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function qn(e,t){if(e.transformed)return e;var i,r,n,s=1<<e.z,o=e.x,a=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<u.length;r+=2)l.geometry.push(Wn(u[r],u[r+1],t,s,o,a));else for(r=0;r<u.length;r++){var c=[];for(n=0;n<u[r].length;n+=2)c.push(Wn(u[r][n],u[r][n+1],t,s,o,a));l.geometry.push(c)}}return e.transformed=!0,e}function Wn(e,t,i,r,n,s){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-s))]}function Zn(e,t,i,r,n){for(var s=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Hn(o,e[a],s,n);var l=e[a].minX,u=e[a].minY,h=e[a].maxX,c=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),h>o.maxX&&(o.maxX=h),c>o.maxY&&(o.maxY=c)}return o}function Hn(e,t,i,r){var n=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<n.length;a+=3)o.push(n[a]),o.push(n[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Xn(o,n,e,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<n.length;a++)Xn(o,n[a],e,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<n.length;l++){var u=n[l];for(a=0;a<u.length;a++)Xn(o,u[a],e,i,!0,0===a)}if(o.length){var h=t.tags||null;if("LineString"===s&&r.lineMetrics){for(var c in h={},t.tags)h[c]=t.tags[c];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:h};null!==t.id&&(d.id=t.id),e.features.push(d)}}function Xn(e,t,i,r,n,s){var o=r*r;if(r>0&&t.size<(n?o:r))i.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(i.numSimplified++,a.push(t[l]),a.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,s=n-2;r<n;s=r,r+=2)i+=(e[r]-e[s])*(e[r+1]+e[s+1]);if(i>0===t)for(r=0,n=e.length;r<n/2;r+=2){var o=e[r],a=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=o,e[n-1-r]=a}}(a,s),e.push(a)}}function Yn(e,t){return new Jn(e,t)}function Jn(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)zn(i,e.features[r],t,r);else"Feature"===e.type?zn(i,e,t):zn(i,{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var i=t.buffer/t.extent,r=e,n=Ln(e,1,-1-i,i,0,-1,2,t),s=Ln(e,1,1-i,2+i,0,-1,2,t);return(n||s)&&(r=Ln(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=Vn(n,1).concat(r)),s&&(r=r.concat(Vn(s,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.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 Kn(e,t,i){return 32*((1<<e)*i+t)+e}we.register("MVT",()=>An),Jn.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Jn.prototype.splitTile=function(e,t,i,r,n,s,o){for(var a=[e,t,i,r],l=this.options,u=l.debug;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();var h=1<<t,c=Kn(t,i,r),d=this.tiles[c];if(!d&&(u>1&&console.time("creation"),d=this.tiles[c]=Zn(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=e,n){if(t===l.maxZoom||t===n)continue;var p=1<<n-t;if(i!==Math.floor(s/p)||r!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var _,m,g,y,b,v,x=.5*l.buffer/l.extent,w=.5-x,A=.5+x,T=1+x;_=m=g=y=null,b=Ln(e,h,i-x,i+A,0,d.minX,d.maxX,l),v=Ln(e,h,i+w,i+T,0,d.minX,d.maxX,l),e=null,b&&(_=Ln(b,h,r-x,r+A,1,d.minY,d.maxY,l),m=Ln(b,h,r+w,r+T,1,d.minY,d.maxY,l),b=null),v&&(g=Ln(v,h,r-x,r+A,1,d.minY,d.maxY,l),y=Ln(v,h,r+w,r+T,1,d.minY,d.maxY,l),v=null),u>1&&console.timeEnd("clipping"),a.push(_||[],t+1,2*i,2*r),a.push(m||[],t+1,2*i,2*r+1),a.push(g||[],t+1,2*i+1,2*r),a.push(y||[],t+1,2*i+1,2*r+1)}}},Jn.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,s=r.debug;if(e<0||e>24)return null;var o=1<<e,a=Kn(e,t=(t%o+o)%o,i);if(this.tiles[a])return qn(this.tiles[a],n);s>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,h=t,c=i;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[Kn(u,h,c)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,h,c),s>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?qn(this.tiles[a],n):null):null};class Qn extends Te{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&m("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Yn(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:V.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let i,r=V.wrapTile(e.coords,{x:!0}),n=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(n&&n.features){i={type:"FeatureCollection",features:[]};for(let e=0;e<n.features.length;e++){const t=n.features[e];let r={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)r.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),r.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(r.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)r.geometry.type="MultiLineString";else if(r.geometry=Tn(r.geometry),null==r.geometry)continue}i.features.push(r)}}return i}formatURL(){return this.url}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i,n=this.getLayers(r);t.layers=this.preprocessLayers(n,e)}preprocessLayers(e,t){for(let t in e){let i=e[t];i.features=this.preprocessFeatures(i.features)}if("function"==typeof this.transform){const i={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,i):e=this.transform(e,this.extra_data,i)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],i={label_placement:!0};e.forEach(e=>{let r,n;if("Polygon"===e.geometry.type)r=e.geometry.coordinates,n=ts(r,e.id,e.properties,i),t.push(n);else if("MultiPolygon"===e.geometry.type){r=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<r.length;e++){let t=V.polygonArea(r[e]);t>s&&(s=t,o=e)}n=ts(r[o],e.id,e.properties,i),t.push(n)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class es extends ke{constructor(e,t){super(e,t)}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;this.prepareGeoJSON(r,e,t)}prepareGeoJSON(e,t,i){if("function"==typeof this.transform){const i={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,i)}i.layers=Qn.prototype.getLayers(e);let r={coords:t.coords,min:V.metersForTile(V.wrapTile(t.coords,{x:!0}))};we.projectData(i),we.scaleData(i,r)}}function ts(e,t,i,r){let n=V.centroid(e);if(!n)return;let s={};return Object.assign(s,i,r),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:n}}}function is(e){return e}function rs(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,s=function(e,t){var i=function(e){if(null==(t=e.transform))return is;var t,i,r,n=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(i=r=0),e[0]=(i+=e[0])*n+o,e[1]=(r+=e[1])*s+a,e}}(e),r=e.arcs;function n(e,t){t.length&&t.pop();for(var n=r[e<0?~e:e],s=0,o=n.length;s<o;++s)t.push(i(n[s].slice(),s));e<0&&function(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}(t,o)}function s(e){return i(e.slice())}function o(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var i,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":i=s(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(s);break;case"LineString":i=o(t.arcs);break;case"MultiLineString":i=t.arcs.map(o);break;case"Polygon":i=l(t.arcs);break;case"MultiPolygon":i=t.arcs.map(l);break;default:return null}return{type:r,coordinates:i}}(t)}(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:s}:null==r?{type:"Feature",id:i,properties:n,geometry:s}:{type:"Feature",id:i,bbox:r,properties:n,geometry:s}}we.register("GeoJSON",e=>es.urlHasTilePattern(e.url)?es:Qn);class ns extends Qn{parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=this.toGeoJSON(r);let n=this.getLayers(r);super.preprocessLayers(n,e),t.layers=n}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=ss(e,e.objects[t])}else{let t={};for(let i in e.objects)t[i]=ss(e,e.objects[i]);e=t}return e}}function ss(e,t){let i=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return rs(e,t)})}:rs(e,t)}(e,t);return"Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),i}class os extends es{constructor(e,t){super(e,t)}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=ns.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t)}}we.register("TopoJSON",e=>os.urlHasTilePattern(e.url)?os:ns),e.Collision=$t,e.DataSource=we,e.FeatureSelection=ce,e.FilterOptions=Wr,e.FontManager=ri,e.GLSL=R,e.Geo=V,e.Label=jt,e.LabelLineStraight=pr,e.LabelPoint=qt,e.Light=be,e.Material=me,e.OBB=Ut,e.ShaderProgram=U,e.Style=Pe,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(vt)),this.register(Object.create(ur)),this.register(Object.create(vr)),this.register(Object.create(xr))}init(){U.removeBlock("global"),U.removeBlock("setup"),U.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),U.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),U.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),U.defines.TANGRAM_EPSILON=1e-5,U.defines.TANGRAM_LAYER_DELTA=1/16384,U.defines.TANGRAM_TILE_SCALE=`vec3(${V.tile_scale}., ${V.tile_scale}., u_meters_per_pixel * ${V.tile_size}.)`,U.defines.TANGRAM_HEIGHT_SCALE=V.height_scale,U.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let i=this.styles[t];i.gl===e&&(m("trace",`StyleManager.destroy: destroying render style ${i.name}`),i.base&&this.remove(i.name),i.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,i])=>{i.forEach(i=>{const r=i.variant.blend_order;let n=t.findIndex(e=>e.blend_order===r);n=n>-1?n:t.push({blend_order:r,styles:[]})-1,-1===t[n].styles.indexOf(e)&&t[n].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let i=[];e.mix&&(Array.isArray(e.mix)?i.push(...e.mix):i.push(e.mix),i=i.map(e=>t[e]).filter(t=>t&&t!==e),i.forEach(t=>e.mixed[t.name]=!0)),i.push(e),e.animated=i.some(e=>e&&e.animated),e.texcoords=i.some(e=>e&&e.texcoords),e.base=i.map(e=>e.base).filter(e=>e).pop(),e.lighting=i.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=i.map(e=>e.texture).filter(e=>e).pop(),e.raster=i.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=i.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=i.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),i.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=i.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=i.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...i.map(e=>e.material).filter(e=>e));let r=i.map(e=>e.draw).filter(e=>e);return r.length>0&&(e.draw=G({},...r)),this.mixShaders(e,t,i),e}mixShaders(e,t,i){let r={},n=i.map(e=>e.shaders).filter(e=>e);if(r.defines=Object.assign({},...n.map(e=>e.defines).filter(e=>e)),r.attributes=Object.assign({},...n.map(e=>e.attributes).filter(e=>e)),r.uniforms={},r._uniforms=e.shaders&&e.shaders.uniforms||{},r._uniform_scopes={},i.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let i in e.shaders.uniforms)r._uniform_scopes[i]=e.name,Object.defineProperty(r.uniforms,i,{enumerable:!0,configurable:!0,get:function(){return void 0!==r._uniforms[i]?r._uniforms[i]:t[r._uniform_scopes[i]].shaders.uniforms!==r.uniforms?t[r._uniform_scopes[i]].shaders.uniforms[i]:void 0},set:function(e){r._uniforms[i]=e}})}),r.extensions=Object.keys(n.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let i=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(i)?e.shaders.block_scopes[t].push(...i.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let s={};return n.forEach(e=>{if(!e.blocks)return;r.blocks=r.blocks||{},r.block_scopes=r.block_scopes||{};let t={};for(let i in e.blocks){let n=e.blocks[i],o=e.block_scopes[i];r.blocks[i]=r.blocks[i]||[],r.block_scopes[i]=r.block_scopes[i]||[],n=Array.isArray(n)?n:[n],o=Array.isArray(o)?o:[o];for(let e=0;e<n.length;e++)s[o[e]]||(t[o[e]]=!0,r.blocks[i].push(n[e]),r.block_scopes[i].push(o[e]))}Object.assign(s,t)}),Object.assign(e.mixed,s),e.shaders=r,e}create(e,t,i={}){let r=G({},t);return r.name=e,r=this.mix(r,i),r.base&&this.base_styles[r.base]?this.styles[e]=r=Object.assign(Object.create(this.base_styles[r.base]),r):r.base=null,r}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?wr(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):wr(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const i=["opaque","add","multiply","overlay","inlay","translucent"],r=["polygons","lines","points","text","raster"];for(const e of i)for(const i of r){const r=e+"_"+i;null==t[r]&&(t[r]={base:i,blend:e})}let s=Object.keys(t).sort((e,i)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(i,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let o={};return s.forEach(e=>{o[e]=this.create(e,t[e],o)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let i=0;for(;;){let r=t[e];if(!r)break;if(!r.mix)break;if(i++,Array.isArray(r.mix)){i+=Math.max(...r.mix.map(i=>{if(e!==i)return this.inheritanceDepth(i,t)}));break}if(e===r.mix)break;e=r.mix}return i}},e.StyleParser=Q,e.Task=T,e.TextCanvas=wi,e.Texture=S,e.Thread=t,e.Tile=en,e.TileID=Ee,e.Utils=g,e.Vector=ye,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=Le,e.View=class{constructor(e,t){k(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=nr.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*g.device_pixel_ratio),height:Math.round(this.size.css.height*g.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:i}={}){var r=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(r=!0,this.center={lng:e,lat:t})),"number"==typeof i&&i!==this.zoom&&(r=!0,this.setZoom(i)),r&&this.updateBounds(),r}setZoom(e){let t=this.tile_zoom,i=this.baseZoom(e);this.continuous_zoom||(e=i),i!==t&&(this.zoom_direction=i>t?1:-1),this.zoom=e,this.tile_zoom=i,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=V.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=V.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=V.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=V.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),i=V.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,i.x+this.buffer,i.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;r=r.map(e=>Math.min(Math.max(0,e),t))}let n=[];for(let t=r[0];t<=r[1];t++)for(let i=r[2];i<=r[3];i++)n.push(Ee.coord({x:t,y:i,z:e}));return n}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*V.tile_size,i=Ee.coordAtZoom(V.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),r=Ee.coordAtZoom(V.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<i.x||e.coords.x>r.x||e.coords.y<i.y||e.coords.y>r.y)&&(m("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${i.key}, ${r.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",g.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=n,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var i,r="/"!==e[0];if(t?(i=document.createElement("a")).href=t:i=window.location,r)e=v(i.href)+e;else{let t=i.origin;t||(t=i.protocol+"//"+i.host),e=t+e}return e},e.buildFilter=Dr,e.cache=Z,e.clearFunctionStringCache=function(){Z.functions={},Z.num_functions=0,Z.num_cached=0},e.compileFunctionStrings=H,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,m("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=b,e.debugSumLayerStats=function(e){let t={},i={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(i=>{let r=e.debug.layers.list[i];Oe(t,i,r.features,r.geoms,r.styles,r.base)}),tn(e.debug.layers.tree,i)}),{list:t,tree:i}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),i},e.getDefaultExportFromCjs=O,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Zr,e.layerCache=function(){return jr},e.log=m,e.mergeDebugSettings=function(e){Object.assign(y,e)},e.mergeObjects=G,e.parseLayers=function(e,t){jr={};let i={};for(let r in e){let n=e[r];n&&(i[r]=Hr(r,n,null,t))}return i},e.pathForURL=v,e.sliceObject=E,e.subscribeMixin=k,e.version=o}),r(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,i,r,n,s,o,a){return this.scene_id=t,this._worker_id=i,this.num_workers=r,e.log.setLevel(n),e.Utils.device_pixel_ratio=s,e.VertexElements.setElementIndexUint(o),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=i,e.Label.id_multiplier=r,i},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let i=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===i.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:i,introspection:r},n){return t=JSON.parse(t),e.mergeDebugSettings(n),this.generation=i,this.introspection=r,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let i=this.sources,r=[];this.sources={};for(let n in t.sources){if(JSON.stringify(this.last_config_sources[n])===JSON.stringify(t.sources[n])){this.sources[n]=i[n];continue}let s;t.sources[n]=e.compileFunctionStrings(t.sources[n]);try{s=e.DataSource.create(Object.assign({},t.sources[n],{name:n}),this.sources)}catch(e){continue}s&&(this.sources[n]=s,r.push(n))}r.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(i=>{t.loading=!1,t.loaded=!1,t.error=i.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(i){t.error=i.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const i in this.tiles){const r=this.tiles[i];if(r.source===e.source&&r.coords.key===e.coords.key&&r.loaded)return Promise.resolve(t.copyTileData(r,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var i=this.tiles[t];null!=i&&(!0===i.loading&&(e.log("trace",`cancel tile load for ${t}`),i.loading=!1,e.Tile.cancel(i)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:i,geometry:r,tile_keys:n}){let s=[],o=n.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),o.forEach(n=>{for(let o in n.source_data.layers){let a=n.source_data.layers[o];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===i&&!l||!1===i&&l)return;let u=e.StyleParser.getFeatureParseContext(a,n,this.global);if(u.source=n.source,u.layer=o,u.id=a.id,!t(u))return;let h={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===r&&(h.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(h.geometry,n.coords.z,n.min)),s.push(h)})}}),s},getFeatureSelection({id:t,key:i}={}){var r=e.FeatureSelection.map[i];return{id:t,feature:r&&r.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let i=[];return t&&i.push(...Object.keys(t)),e.log("trace","sync textures to worker:",i),i.length>0?e.Texture.syncTexturesToWorker(i):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),r(0,function(e){var t,r=t={};let n=0;function s(e,t){var i;const r=t[t.length-1];return null===(i=a(e,t))||void 0===i?void 0:i[r]}function o(e,t,i){const r=t[t.length-1],n=a(e,t);n&&(n[r]=i)}function a(e,t){if(0===t.length)return;let i=e;for(let e=0;e<t.length-1;e++)if(i=i[t[e]],null==i)return;return i}t.getContext=function(e,i){var r=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),r=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=n++,r?(t.resize(s,window.innerWidth,window.innerHeight,i.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(s,window.innerWidth,window.innerHeight,i.device_pixel_ratio)})):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),i.device_pixel_ratio),s},t.resize=function(e,t,i,r){r=r||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=i+"px",e.canvas.width=Math.round(t*r),e.canvas.height=Math.round(i*r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const l="global.",u="__global_prop";function h(e){return(null==e?void 0:e.slice(0,7))===l}function c(e,t){var i;const r=Array.isArray(t)?t:[t],n=a(e,r),s=r[r.length-1];return void 0!==(null==n||null===(i=n[u])||void 0===i?void 0:i[s])}function d(e,t=null,i={}){t=t?t+".":l;for(const r in e){const n=t+r,s=e[r];i[n]=s,"object"!=typeof s||Array.isArray(s)||d(s,n,i)}return i}function f(t,i,r,n){var s;let o;if(null!=r&&null!==(s=r[u])&&void 0!==s&&s[n]?o=r[u][n]:"string"==typeof i&&i.slice(0,7)===l&&(o=i),o){null==r[u]&&Object.defineProperty(r,u,{value:{}}),r[u][n]=o;let i,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===l;){if(i=i||[o],i.indexOf(s)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",i),s=null;break}i.push(s),s=t[s]}Object.defineProperty(r,n,{enumerable:!0,get:function(){return s},set:function(e){delete r[u][n],delete r[n],r[n]=e}})}else if(Array.isArray(i))for(let e=0;e<i.length;e++)f(t,i[e],i,e);else if("object"==typeof i)for(const e in i)f(t,i[e],i,e);return i}var p="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_=[],m=[],g="undefined"!=typeof Uint8Array?Uint8Array:Array,y=!1;function b(){y=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)_[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,i){for(var r,n,s=[],o=t;o<i;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(_[(n=r)>>18&63]+_[n>>12&63]+_[n>>6&63]+_[63&n]);return s.join("")}function x(e){var t;y||b();for(var i=e.length,r=i%3,n="",s=[],o=16383,a=0,l=i-r;a<l;a+=o)s.push(v(e,a,a+o>l?l:a+o));return 1===r?(t=e[i-1],n+=_[t>>2],n+=_[t<<4&63],n+="=="):2===r&&(t=(e[i-2]<<8)+e[i-1],n+=_[t>>10],n+=_[t>>4&63],n+=_[t<<2&63],n+="="),s.push(n),s.join("")}function w(e,t,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=i?n-1:0,d=i?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)}function A(e,t,i,r,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,p=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[i+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[i+f]=255&o,f+=p,o/=256,u-=8);e[i+f-p]|=128*_}var T={}.toString,k=Array.isArray||function(e){return"[object Array]"==T.call(e)};z.TYPED_ARRAY_SUPPORT=void 0===p.TYPED_ARRAY_SUPPORT||p.TYPED_ARRAY_SUPPORT;var E=S();function S(){return z.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(e,t){if(S()<t)throw new RangeError("Invalid typed array length");return z.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=z.prototype:(null===e&&(e=new z(t)),e.length=t),e}function z(e,t,i){if(!(z.TYPED_ARRAY_SUPPORT||this instanceof z))return new z(e,t,i);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return O(this,e)}return M(this,e,t,i)}function M(e,t,i,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,i,r){if(t.byteLength,i<0||t.byteLength<i)throw new RangeError("'offset' is out of bounds");if(t.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===i&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,i):new Uint8Array(t,i,r),z.TYPED_ARRAY_SUPPORT?(e=t).__proto__=z.prototype:e=N(e,t),e}(e,t,i,r):"string"==typeof t?function(e,t,i){if("string"==typeof i&&""!==i||(i="utf8"),!z.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|I(t,i),n=(e=R(e,r)).write(t,i);return n!==r&&(e=e.slice(0,n)),e}(e,t,i):function(e,t){if(L(t)){var i=0|C(t.length);return 0===(e=R(e,i)).length||t.copy(e,0,0,i),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?R(e,0):N(e,t);if("Buffer"===t.type&&k(t.data))return N(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function P(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function O(e,t){if(P(t),e=R(e,t<0?0:0|C(t)),!z.TYPED_ARRAY_SUPPORT)for(var i=0;i<t;++i)e[i]=0;return e}function N(e,t){var i=t.length<0?0:0|C(t.length);e=R(e,i);for(var r=0;r<i;r+=1)e[r]=255&t[r];return e}function C(e){if(e>=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function L(e){return!(null==e||!e._isBuffer)}function I(e,t){if(L(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return ue(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return he(e).length;default:if(r)return ue(e).length;t=(""+t).toLowerCase(),r=!0}}function F(e,t,i){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return K(this,t,i);case"utf8":case"utf-8":return H(this,t,i);case"ascii":return Y(this,t,i);case"latin1":case"binary":return J(this,t,i);case"base64":return Z(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,i);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function D(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function U(e,t,i,r,n){if(0===e.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(n)return-1;i=e.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof t&&(t=z.from(t,r)),L(t))return 0===t.length?-1:j(e,t,i,r,n);if("number"==typeof t)return t&=255,z.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):j(e,[t],i,r,n);throw new TypeError("val must be string, number or Buffer")}function j(e,t,i,r,n){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,i/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var h=-1;for(s=i;s<a;s++)if(u(e,s)===u(t,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===l)return h*o}else-1!==h&&(s-=s-h),h=-1}else for(i+l>a&&(i=a-l),s=i;s>=0;s--){for(var c=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){c=!1;break}if(c)return s}return-1}function B(e,t,i,r){i=Number(i)||0;var n=e.length-i;r?(r=Number(r))>n&&(r=n):r=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[i+o]=a}return o}function G(e,t,i,r){return ce(ue(t,e.length-i),e,i,r)}function V(e,t,i,r){return ce(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,r)}function $(e,t,i,r){return V(e,t,i,r)}function q(e,t,i,r){return ce(he(t),e,i,r)}function W(e,t,i,r){return ce(function(e,t){for(var i,r,n,s=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(i=e.charCodeAt(o))>>8,n=i%256,s.push(n),s.push(r);return s}(t,e.length-i),e,i,r)}function Z(e,t,i){return 0===t&&i===e.length?x(e):x(e.slice(t,i))}function H(e,t,i){i=Math.min(e.length,i);for(var r=[],n=t;n<i;){var s,o,a,l,u=e[n],h=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=i)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(s=e[n+1]))&&(l=(31&u)<<6|63&s)>127&&(h=l);break;case 3:s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:s=e[n+1],o=e[n+2],a=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),n+=c}return function(e){var t=e.length;if(t<=X)return String.fromCharCode.apply(String,e);for(var i="",r=0;r<t;)i+=String.fromCharCode.apply(String,e.slice(r,r+=X));return i}(r)}z.poolSize=8192,z._augment=function(e){return e.__proto__=z.prototype,e},z.from=function(e,t,i){return M(null,e,t,i)},z.TYPED_ARRAY_SUPPORT&&(z.prototype.__proto__=Uint8Array.prototype,z.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&z[Symbol.species]),z.alloc=function(e,t,i){return function(e,t,i,r){return P(t),t<=0?R(e,t):void 0!==i?"string"==typeof r?R(e,t).fill(i,r):R(e,t).fill(i):R(e,t)}(null,e,t,i)},z.allocUnsafe=function(e){return O(null,e)},z.allocUnsafeSlow=function(e){return O(null,e)},z.isBuffer=de,z.compare=function(e,t){if(!L(e)||!L(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,r=t.length,n=0,s=Math.min(i,r);n<s;++n)if(e[n]!==t[n]){i=e[n],r=t[n];break}return i<r?-1:r<i?1:0},z.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},z.concat=function(e,t){if(!k(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return z.alloc(0);var i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;var r=z.allocUnsafe(t),n=0;for(i=0;i<e.length;++i){var s=e[i];if(!L(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},z.byteLength=I,z.prototype._isBuffer=!0,z.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)D(this,t,t+1);return this},z.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)D(this,t,t+3),D(this,t+1,t+2);return this},z.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},z.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):F.apply(this,arguments)},z.prototype.equals=function(e){if(!L(e))throw new TypeError("Argument must be a Buffer");return this===e||0===z.compare(this,e)},z.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},z.prototype.compare=function(e,t,i,r,n){if(!L(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),t<0||i>e.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&t>=i)return 0;if(r>=n)return-1;if(t>=i)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(r,n),u=e.slice(t,i),h=0;h<a;++h)if(l[h]!==u[h]){s=l[h],o=u[h];break}return s<o?-1:o<s?1:0},z.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},z.prototype.indexOf=function(e,t,i){return U(this,e,t,i,!0)},z.prototype.lastIndexOf=function(e,t,i){return U(this,e,t,i,!1)},z.prototype.write=function(e,t,i,r){if(void 0===t)r="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)r=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-t;if((void 0===i||i>n)&&(i=n),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return B(this,e,t,i);case"utf8":case"utf-8":return G(this,e,t,i);case"ascii":return V(this,e,t,i);case"latin1":case"binary":return $(this,e,t,i);case"base64":return q(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;function Y(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(127&e[n]);return r}function J(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(e[n]);return r}function K(e,t,i){var r=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>r)&&(i=r);for(var n="",s=t;s<i;++s)n+=le(e[s]);return n}function Q(e,t,i){for(var r=e.slice(t,i),n="",s=0;s<r.length;s+=2)n+=String.fromCharCode(r[s]+256*r[s+1]);return n}function ee(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function te(e,t,i,r,n,s){if(!L(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(i+r>e.length)throw new RangeError("Index out of range")}function ie(e,t,i,r){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-i,2);n<s;++n)e[i+n]=(t&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function re(e,t,i,r){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-i,4);n<s;++n)e[i+n]=t>>>8*(r?n:3-n)&255}function ne(e,t,i,r,n,s){if(i+r>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function se(e,t,i,r,n){return n||ne(e,0,i,4),A(e,t,i,r,23,4),i+4}function oe(e,t,i,r,n){return n||ne(e,0,i,8),A(e,t,i,r,52,8),i+8}z.prototype.slice=function(e,t){var i,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),z.TYPED_ARRAY_SUPPORT)(i=this.subarray(e,t)).__proto__=z.prototype;else{var n=t-e;i=new z(n,void 0);for(var s=0;s<n;++s)i[s]=this[s+e]}return i},z.prototype.readUIntLE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e],n=1,s=0;++s<t&&(n*=256);)r+=this[e+s]*n;return r},z.prototype.readUIntBE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e+--t],n=1;t>0&&(n*=256);)r+=this[e+--t]*n;return r},z.prototype.readUInt8=function(e,t){return t||ee(e,1,this.length),this[e]},z.prototype.readUInt16LE=function(e,t){return t||ee(e,2,this.length),this[e]|this[e+1]<<8},z.prototype.readUInt16BE=function(e,t){return t||ee(e,2,this.length),this[e]<<8|this[e+1]},z.prototype.readUInt32LE=function(e,t){return t||ee(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},z.prototype.readUInt32BE=function(e,t){return t||ee(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},z.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e],n=1,s=0;++s<t&&(n*=256);)r+=this[e+s]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*t)),r},z.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=t,n=1,s=this[e+--r];r>0&&(n*=256);)s+=this[e+--r]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},z.prototype.readInt8=function(e,t){return t||ee(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},z.prototype.readInt16LE=function(e,t){t||ee(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},z.prototype.readInt16BE=function(e,t){t||ee(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},z.prototype.readInt32LE=function(e,t){return t||ee(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},z.prototype.readInt32BE=function(e,t){return t||ee(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},z.prototype.readFloatLE=function(e,t){return t||ee(e,4,this.length),w(this,e,!0,23,4)},z.prototype.readFloatBE=function(e,t){return t||ee(e,4,this.length),w(this,e,!1,23,4)},z.prototype.readDoubleLE=function(e,t){return t||ee(e,8,this.length),w(this,e,!0,52,8)},z.prototype.readDoubleBE=function(e,t){return t||ee(e,8,this.length),w(this,e,!1,52,8)},z.prototype.writeUIntLE=function(e,t,i,r){e=+e,t|=0,i|=0,r||te(this,e,t,i,Math.pow(2,8*i)-1,0);var n=1,s=0;for(this[t]=255&e;++s<i&&(n*=256);)this[t+s]=e/n&255;return t+i},z.prototype.writeUIntBE=function(e,t,i,r){e=+e,t|=0,i|=0,r||te(this,e,t,i,Math.pow(2,8*i)-1,0);var n=i-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+i},z.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,1,255,0),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},z.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ie(this,e,t,!0),t+2},z.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ie(this,e,t,!1),t+2},z.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):re(this,e,t,!0),t+4},z.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},z.prototype.writeIntLE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);te(this,e,t,i,n-1,-n)}var s=0,o=1,a=0;for(this[t]=255&e;++s<i&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+i},z.prototype.writeIntBE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);te(this,e,t,i,n-1,-n)}var s=i-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+i},z.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,1,127,-128),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},z.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ie(this,e,t,!0),t+2},z.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ie(this,e,t,!1),t+2},z.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,2147483647,-2147483648),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):re(this,e,t,!0),t+4},z.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},z.prototype.writeFloatLE=function(e,t,i){return se(this,e,t,!0,i)},z.prototype.writeFloatBE=function(e,t,i){return se(this,e,t,!1,i)},z.prototype.writeDoubleLE=function(e,t,i){return oe(this,e,t,!0,i)},z.prototype.writeDoubleBE=function(e,t,i){return oe(this,e,t,!1,i)},z.prototype.copy=function(e,t,i,r){if(i||(i=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-i&&(r=e.length-t+i);var n,s=r-i;if(this===e&&i<t&&t<r)for(n=s-1;n>=0;--n)e[n+t]=this[n+i];else if(s<1e3||!z.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)e[n+t]=this[n+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),t);return s},z.prototype.fill=function(e,t,i,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!z.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;var s;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(s=t;s<i;++s)this[s]=e;else{var o=L(e)?e:ue(new z(e,r).toString()),a=o.length;for(s=0;s<i-t;++s)this[s+t]=o[s%a]}return this};var ae=/[^+\/0-9A-Za-z-_]/g;function le(e){return e<16?"0"+e.toString(16):e.toString(16)}function ue(e,t){var i;t=t||1/0;for(var r=e.length,n=null,s=[],o=0;o<r;++o){if((i=e.charCodeAt(o))>55295&&i<57344){if(!n){if(i>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(t-=3)>-1&&s.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((t-=1)<0)break;s.push(i)}else if(i<2048){if((t-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function he(e){return function(e){var t,i,r,n,s,o;y||b();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new g(3*a/4-s),r=s>0?a-4:a;var l=0;for(t=0,i=0;t<r;t+=4,i+=3)n=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],o[l++]=n>>16&255,o[l++]=n>>8&255,o[l++]=255&n;return 2===s?(n=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,o[l++]=255&n):1===s&&(n=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,o[l++]=n>>8&255,o[l++]=255&n),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ae,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,i,r){for(var n=0;n<r&&!(n+i>=t.length||n>=e.length);++n)t[n+i]=e[n];return n}function de(e){return null!=e&&(!!e._isBuffer||fe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&fe(e.slice(0,0))}(e))}function fe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var pe=Object.freeze({__proto__:null,Buffer:z,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),z.alloc(+e)},isBuffer:de,kMaxLength:E});function _e(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var ge=_e,ye=me;function be(e){if(ge===setTimeout)return setTimeout(e,0);if((ge===_e||!ge)&&setTimeout)return ge=setTimeout,setTimeout(e,0);try{return ge(e,0)}catch(t){try{return ge.call(null,e,0)}catch(t){return ge.call(this,e,0)}}}"function"==typeof p.setTimeout&&(ge=setTimeout),"function"==typeof p.clearTimeout&&(ye=clearTimeout);var ve,xe=[],we=!1,Ae=-1;function Te(){we&&ve&&(we=!1,ve.length?xe=ve.concat(xe):Ae=-1,xe.length&&ke())}function ke(){if(!we){var e=be(Te);we=!0;for(var t=xe.length;t;){for(ve=xe,xe=[];++Ae<t;)ve&&ve[Ae].run();Ae=-1,t=xe.length}ve=null,we=!1,function(e){if(ye===clearTimeout)return clearTimeout(e);if((ye===me||!ye)&&clearTimeout)return ye=clearTimeout,clearTimeout(e);try{return ye(e)}catch(t){try{return ye.call(null,e)}catch(t){return ye.call(this,e)}}}(e)}}function Ee(e,t){this.fun=e,this.array=t}Ee.prototype.run=function(){this.fun.apply(null,this.array)};var Se=p.performance||{};function Re(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Se.now||Se.mozNow||Se.msNow||Se.oNow||Se.webkitNow;var ze,Me,Pe,Oe,Ne,Ce,Le,Ie,Fe,De,Ue,je,Be,Ge,Ve,$e,qe,We,Ze,He,Xe,Ye,Je,Ke,Qe,et,tt,it,rt,nt,st,ot,at,lt,ut={exports:{}},ht=(ze||(ze=1,ut.exports=function e(t,i,r){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&Re)return Re(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[o]={exports:{}};t[o][0].call(u.exports,function(e){return n(t[o][1][e]||e)},u,u.exports,e,t,i,r)}return i[o].exports}for(var s=Re,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,l,u,h=[],c=0,d=e.length,f=d,p="string"!==r.getTypeOf(e);c<e.length;)f=d-c,n=p?(t=e[c++],i=c<d?e[c++]:0,c<d?e[c++]:0):(t=e.charCodeAt(c++),i=c<d?e.charCodeAt(c++):0,c<d?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|i>>4,l=1<f?(15&i)<<2|n>>6:64,u=2<f?63&n:64,h.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return h.join("")},i.decode=function(e){var t,i,r,o,a,l,u=0,h=0,c="data:";if(e.substr(0,5)===c)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=n.uint8array?new Uint8Array(0|f):new Array(0|f);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,i=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,r=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),d[h++]=t,64!==a&&(d[h++]=i),64!==l&&(d[h++]=r);return d}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,s=0+i;e^=-1;for(var o=0;o<s;o++)e=e>>>8^r[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,i){var r=n,s=0+i;e^=-1;for(var o=0;o<s;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new l("Deflate",e)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,h){var c,d,f=e.file,p=e.compression,_=h!==a.utf8encode,m=s.transformTo("string",h(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,b=s.transformTo("string",h(y)),v=s.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,w=v.length!==y.length,A="",T="",k="",E=f.dir,S=f.date,R={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(R.crc32=e.crc32,R.compressedSize=e.compressedSize,R.uncompressedSize=e.uncompressedSize);var z=0;t&&(z|=8),_||!x&&!w||(z|=2048);var M=0,P=0;E&&(M|=16),"UNIX"===o?(P=798,M|=function(e,t){var i=e;return e||(i=t?16893:33204),(65535&i)<<16}(f.unixPermissions,E)):(P=20,M|=function(e){return 63&(e||0)}(f.dosPermissions)),c=S.getUTCHours(),c<<=6,c|=S.getUTCMinutes(),c<<=5,c|=S.getUTCSeconds()/2,d=S.getUTCFullYear()-1980,d<<=4,d|=S.getUTCMonth()+1,d<<=5,d|=S.getUTCDate(),x&&(T=r(1,1)+r(l(m),4)+g,A+="up"+r(T.length,2)+T),w&&(k=r(1,1)+r(l(b),4)+v,A+="uc"+r(k.length,2)+k);var O="";return O+="\n\0",O+=r(z,2),O+=p.magic,O+=r(c,2),O+=r(d,2),O+=r(R.crc32,4),O+=r(R.compressedSize,4),O+=r(R.uncompressedSize,4),O+=r(m.length,2),O+=r(A.length,2),{fileRecord:u.LOCAL_FILE_HEADER+O+m+A,dirRecord:u.CENTRAL_FILE_HEADER+r(P,2)+O+r(b.length,2)+"\0\0\0\0"+r(M,4)+r(n,4)+m+A+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function h(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,n=function(e,t,i,n,o){var a=s.transformTo("string",o(n));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(i,4)+r(a.length,2)+a}(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var s=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},l=i.dir,u=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new n.Promise(function(t,i){var r=e.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){i(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var i=new o(t);return i.load(e),i}).then(function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var s=0;s<r.length;s++)i.push(u(r[s]));return n.Promise.all(i)}).then(function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=r.resolve(a.fileNameStr);i.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(u).unsafeOriginalName=l)}return n.zipComment.length&&(i.comment=n.zipComment),i})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(s,n),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),i&&i(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:void 0!==z,newBufferFrom:function(e,t){if(z.from&&z.from!==Uint8Array.from)return z.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new z(e,t)},allocBuffer:function(e){if(z.alloc)return z.alloc(e);var t=new z(e);return t.fill(0),t},isBuffer:function(e){return de(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=s.getTypeOf(t),a=s.extend(i||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=_(e)),a.createFolders&&(r=p(e))&&m.call(this,r,!0);var c="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!c),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var g;g=t instanceof u||t instanceof o?t:d.isNode&&d.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new h(e,g,a);this.files[e]=y}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),h=e("./zipObject"),c=e("./generate"),d=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},_=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},m=function(e,t){return t=void 0!==t?t:l.createFolders,e=_(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach(function(i,r){e(i,r)&&t.push(r)}),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(g(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(g(e))return this.filter(function(t,i){return i.dir&&e.test(t)});var t=this.root+e,i=m.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(t,i){return i.name.slice(0,e.length)===e}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");s.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=c.generateWorker(this,i,r)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===i&&this.data[s+2]===r&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&i===s[1]&&r===s[2]&&n===s[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new l(r.transformTo("uint8array",e)):new s(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function s(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(s,r),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,r),s.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}h.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(i,n){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,i){s.push(e),t&&t(i)}).on("error",function(e){s=[],n(e)}).on("end",function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var i,r=0,n=null,s=0;for(i=0;i<t.length;i++)s+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(s),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return z.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);i(e)}catch(e){n(e)}s=[]}).resume()})}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,function(e){t.call(i,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,i)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer=void 0!==z,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,i,r,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,s,o=e.length,l=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)l[i++]=n;else if(4<(s=a[n]))l[i++]=65533,t+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),r.applyFromCharCode(l)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(u,o),u.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),l=t;o!==t.length&&(n.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,r.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,i){var r=[],n=0,s=e.length;if(s<=i)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,s)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,s)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=u.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=u.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return u.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function c(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var d={};d.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},d.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},d.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},d.nodebuffer={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return d[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&s.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var h=i.getTypeOf(t);return h?("arraybuffer"===h?t=i.transformTo("uint8array",t):"string"===h&&(u?t=n.decode(t):s&&!0!==a&&(t=function(e){return l(e,r.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var s=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)r.prototype[u[c]]=h;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,i=function(){l.port2.postMessage(0)}}var u=[];function h(){var e,t;r=!0;for(var i=u.length;i;){for(t=u,u=[],e=-1;++e<i;)t[e]();i=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||i()}}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==n&&f(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function c(e,t,i){r(function(){var r;try{r=t(i)}catch(r){return s.reject(e,r)}r===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,r)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var i=!1;function r(t){i||(i=!0,s.reject(e,t))}function n(t){i||(i=!0,s.resolve(e,t))}var o=p(function(){t(n,r)});"error"===o.status&&r(o.value)}function p(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(i){return t.resolve(e()).then(function(){return i})},function(i){return t.resolve(e()).then(function(){throw i})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==l?c(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){s.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e)},s.resolve=function(e,t){var i=p(d,t);if("error"===i.status)return s.reject(e,i.value);var r=i.value;if(r)f(e,r);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},u.reject=function(e){var t=new this(n);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,l=-1,u=new this(n);++l<i;)h(e[l],l);return u;function h(e,n){t.resolve(e).then(function(e){o[n]=e,++a!==i||r||(r=!0,s.resolve(u,o))},function(e){r||(r=!0,s.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,i=!1;if(!t)return this.resolve([]);for(var r,o=-1,a=new this(n);++o<t;)r=e[o],this.resolve(r).then(function(e){i||(i=!0,s.resolve(a,e))},function(e){i||(i=!0,s.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var h;if(h="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,h)))throw new Error(o[i]);this._dict_set=!0}}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}u.prototype.push=function(e,t){var i,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(u),a.next_out=0,a.avail_out=u),1!==(i=r.deflate(a,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=u,i.deflate=h,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,h(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),h=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function d(e,t){var i=new c(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}c.prototype.push=function(e,t){var i,a,l,u,c,d,f=this.strm,p=this.options.chunkSize,_=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new n.Buf8(p),f.next_out=0,f.avail_out=p),(i=r.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&_&&(d="string"==typeof _?s.string2buf(_):"[object ArrayBuffer]"===h.call(_)?new Uint8Array(_):_,i=r.inflateSetDictionary(this.strm,d)),i===o.Z_BUF_ERROR&&!0===m&&(i=o.Z_OK,m=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&i!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(f.output,f.next_out),u=f.next_out-l,c=s.buf2string(f.output,l),f.next_out=u,f.avail_out=p-u,u&&n.arraySet(f.output,f.output,l,u,0),this.onData(c)):this.onData(n.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(m=!0)}while((0<f.avail_in||0===f.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=c,i.inflate=d,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var s=0;s<r;s++)e[n+s]=t[i+s]},flattenChunks:function(e){var t,i,r,n,s,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,i,r,n){for(var s=0;s<r;s++)e[n+s]=t[i+s]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,s))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(l),s=o=0;o<l;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return l(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,s,a=t||e.length,u=new Array(2*a);for(i=r=0;i<a;)if((n=e[i++])<128)u[r++]=n;else if(4<(s=o[n]))u[r++]=65533,i+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&i<a;)n=n<<6|63&e[i++],s--;1<s?u[r++]=65533:n<65536?u[r++]=n:(n-=65536,u[r++]=55296|n>>10&1023,u[r++]=56320|1023&n)}return l(u,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,s=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;s=s+(n=n+t[r++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16}},{}],44:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,i){var r=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var s=r,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,h=258,c=262,d=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4<e?9:0)}function _(e){for(var t=e.length;0<=--t;)e[t]=0}function m(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function g(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,m(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function v(e,t){var i,r,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-c?e.strstart-(e.w_size-c):0,u=e.window,d=e.w_mask,f=e.prev,p=e.strstart+h,_=u[s+o-1],m=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(i=t)+o]===m&&u[i+o-1]===_&&u[i]===u[s]&&u[++i]===u[s+1]){s+=2,i++;do{}while(u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&s<p);if(r=h-(p-s),s=p-h,o<r){if(e.match_start=t,a<=(o=r))break;_=u[s+o-1],m=u[s+o]}}}while((t=f[t&d])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function x(e){var t,i,r,s,l,u,h,d,f,p,_=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=_+(_-c)){for(n.arraySet(e.window,e.window,_,_,0),e.match_start-=_,e.strstart-=_,e.block_start-=_,t=i=e.hash_size;r=e.head[--t],e.head[t]=_<=r?r-_:0,--i;);for(t=i=_;r=e.prev[--t],e.prev[t]=_<=r?r-_:0,--i;);s+=_}if(0===e.strm.avail_in)break;if(u=e.strm,h=e.window,d=e.strstart+e.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),i=0===p?0:(u.avail_in-=p,n.arraySet(h,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,h,p,d):2===u.state.wrap&&(u.adler=a(u.adler,h,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=i,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<c&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<c){if(x(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-c&&(e.match_length=v(e,i)),e.match_length>=3)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function A(e,t){for(var i,r,n;;){if(e.lookahead<c){if(x(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-c&&(e.match_length=v(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(g(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=s._tr_tally(e,0,e.window[e.strstart-1]))&&g(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function T(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function k(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),_(this.dyn_ltree),_(this.dyn_dtree),_(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),_(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),_(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:d,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,u)}function S(e){var t=E(e);return 0===t&&function(e){e.window_size=2*e.w_size,_(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function R(e,t,i,r,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),s<1||9<s||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return f(e,u);8===r&&(r=9);var l=new k;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new n.Buf8(2*l.w_size),l.head=new n.Buf16(l.hash_size),l.prev=new n.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new n.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=i,S(e)}r=[new T(0,0,0,0,function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-c&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)}),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,A),new T(8,16,32,32,A),new T(8,16,128,128,A),new T(8,32,128,256,A),new T(32,128,258,1024,A),new T(32,258,258,4096,A)],i.deflateInit=function(e,t){return R(e,t,8,15,8,0)},i.deflateInit2=R,i.deflateReset=S,i.deflateResetKeep=E,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},i.deflate=function(e,t){var i,n,o,l;if(!e||!e.state||5<t||t<0)return e?f(e,u):u;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return f(e,0===e.avail_out?-5:u);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,y(n,31),y(n,139),y(n,8),n.gzhead?(y(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),y(n,255&n.gzhead.time),y(n,n.gzhead.time>>8&255),y(n,n.gzhead.time>>16&255),y(n,n.gzhead.time>>24&255),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(y(n,255&n.gzhead.extra.length),y(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(y(n,0),y(n,0),y(n,0),y(n,0),y(n,0),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,3),n.status=d);else{var c=8+(n.w_bits-8<<4)<<8;c|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(c|=32),c+=31-c%31,n.status=d,b(n,c),0!==n.strstart&&(b(n,e.adler>>>16),b(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending!==n.pending_buf_size));)y(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,y(n,l)}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,y(n,l)}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&m(e),n.pending+2<=n.pending_buf_size&&(y(n,255&e.adler),y(n,e.adler>>8&255),e.adler=0,n.status=d)):n.status=d),0!==n.pending){if(m(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(i)&&4!==t)return f(e,-5);if(666===n.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var v=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=h){if(x(e),e.lookahead<=h&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+h;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=h-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==v&&4!==v||(n.status=666),1===v||3===v)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===v&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(_(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),m(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(y(n,255&e.adler),y(n,e.adler>>8&255),y(n,e.adler>>16&255),y(n,e.adler>>24&255),y(n,255&e.total_in),y(n,e.total_in>>8&255),y(n,e.total_in>>16&255),y(n,e.total_in>>24&255)):(b(n,e.adler>>>16),b(n,65535&e.adler)),m(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==d&&666!==t?f(e,u):(e.state=null,t===d?f(e,-3):0):u},i.deflateSetDictionary=function(e,t){var i,r,s,a,l,h,c,d,f=t.length;if(!e||!e.state)return u;if(2===(a=(i=e.state).wrap)||1===a&&42!==i.status||i.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,f,0)),i.wrap=0,f>=i.w_size&&(0===a&&(_(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,f-i.w_size,i.w_size,0),t=d,f=i.w_size),l=e.avail_in,h=e.next_in,c=e.input,e.avail_in=f,e.next_in=0,e.input=t,x(i);i.lookahead>=3;){for(r=i.strstart,s=i.lookahead-2;i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--s;);i.strstart=r,i.lookahead=2,x(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=h,e.input=c,e.avail_in=l,i.wrap=a,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,s,o,a,l,u,h,c,d,f,p,_,m,g,y,b,v,x,w,A,T,k,E;i=e.state,r=e.next_in,k=e.input,n=r+(e.avail_in-5),s=e.next_out,E=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=i.dmax,u=i.wsize,h=i.whave,c=i.wnext,d=i.window,f=i.hold,p=i.bits,_=i.lencode,m=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{p<15&&(f+=k[r++]<<p,p+=8,f+=k[r++]<<p,p+=8),b=_[f&g];t:for(;;){if(f>>>=v=b>>>24,p-=v,0==(v=b>>>16&255))E[s++]=65535&b;else{if(!(16&v)){if(!(64&v)){b=_[(65535&b)+(f&(1<<v)-1)];continue t}if(32&v){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}x=65535&b,(v&=15)&&(p<v&&(f+=k[r++]<<p,p+=8),x+=f&(1<<v)-1,f>>>=v,p-=v),p<15&&(f+=k[r++]<<p,p+=8,f+=k[r++]<<p,p+=8),b=m[f&y];i:for(;;){if(f>>>=v=b>>>24,p-=v,!(16&(v=b>>>16&255))){if(!(64&v)){b=m[(65535&b)+(f&(1<<v)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&b,p<(v&=15)&&(f+=k[r++]<<p,(p+=8)<v&&(f+=k[r++]<<p,p+=8)),l<(w+=f&(1<<v)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(f>>>=v,p-=v,(v=s-o)<w){if(h<(v=w-v)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=d,(A=0)===c){if(A+=u-v,v<x){for(x-=v;E[s++]=d[A++],--v;);A=s-w,T=E}}else if(c<v){if(A+=u+c-v,(v-=c)<x){for(x-=v;E[s++]=d[A++],--v;);if(A=0,c<x){for(x-=v=c;E[s++]=d[A++],--v;);A=s-w,T=E}}}else if(A+=c-v,v<x){for(x-=v;E[s++]=d[A++],--v;);A=s-w,T=E}for(;2<x;)E[s++]=T[A++],E[s++]=T[A++],E[s++]=T[A++],x-=3;x&&(E[s++]=T[A++],1<x&&(E[s++]=T[A++]))}else{for(A=s-w;E[s++]=E[A++],E[s++]=E[A++],E[s++]=E[A++],2<(x-=3););x&&(E[s++]=E[A++],1<x&&(E[s++]=E[A++]))}break}}break}}while(r<n&&s<a);r-=x=p>>3,f&=(1<<(p-=x<<3))-1,e.next_in=r,e.next_out=s,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=s<a?a-s+257:257-(s-a),i.hold=f,i.bits=p}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):l}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,c(e)):l}function f(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,d(e))):l}function p(e,t){var i,r;return e?(r=new h,(e.state=r).window=null,0!==(i=f(e,t))&&(e.state=null),i):l}var _,m,g=!0;function y(e){if(g){var t;for(_=new r.Buf32(512),m=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,_,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,m,0,e.work,{bits:5}),g=!1}e.lencode=_,e.lenbits=9,e.distcode=m,e.distbits=5}function b(e,t,i,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),r.arraySet(o.window,t,i-n,s,o.wnext),(n-=s)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}i.inflateReset=d,i.inflateReset2=f,i.inflateResetKeep=c,i.inflateInit=function(e){return p(e,15)},i.inflateInit2=p,i.inflate=function(e,t){var i,h,c,d,f,p,_,m,g,v,x,w,A,T,k,E,S,R,z,M,P,O,N,C,L=0,I=new r.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(i=e.state).mode&&(i.mode=13),f=e.next_out,c=e.output,_=e.avail_out,d=e.next_in,h=e.input,p=e.avail_in,m=i.hold,g=i.bits,v=p,x=_,O=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(2&i.wrap&&35615===m){I[i.check=0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0),g=m=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,P=8+(15&(m>>>=4)),0===i.wbits)i.wbits=P;else if(P>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<P,e.adler=i.check=1,i.mode=512&m?10:12,g=m=0;break;case 2:for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(i.flags=m,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=m>>8&1),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0,i.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.head&&(i.head.time=m),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,I[2]=m>>>16&255,I[3]=m>>>24&255,i.check=s(i.check,I,4,0)),g=m=0,i.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.head&&(i.head.xflags=255&m,i.head.os=m>>8),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.length=m,i.head&&(i.head.extra_len=m),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(p<(w=i.length)&&(w=p),w&&(i.head&&(P=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,h,d,w,P)),512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===p)break e;for(w=0;P=h[d+w++],i.head&&P&&i.length<65536&&(i.head.name+=String.fromCharCode(P)),P&&w<p;);if(512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,P)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===p)break e;for(w=0;P=h[d+w++],i.head&&P&&i.length<65536&&(i.head.comment+=String.fromCharCode(P)),P&&w<p;);if(512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,P)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=m=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}e.adler=i.check=u(m),g=m=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){m>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}switch(i.last=1&m,g-=1,3&(m>>>=1)){case 0:i.mode=14;break;case 1:if(y(i),i.mode=20,6!==t)break;m>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}m>>>=2,g-=2;break;case 14:for(m>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if((65535&m)!=(m>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&m,g=m=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(p<w&&(w=p),_<w&&(w=_),0===w)break e;r.arraySet(c,h,d,w,f),p-=w,d+=w,_-=w,f+=w,i.length-=w;break}i.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(i.nlen=257+(31&m),m>>>=5,g-=5,i.ndist=1+(31&m),m>>>=5,g-=5,i.ncode=4+(15&m),m>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.lens[F[i.have++]]=7&m,m>>>=3,g-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},O=a(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,O){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;E=(L=i.lencode[m&(1<<i.lenbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(S<16)m>>>=k,g-=k,i.lens[i.have++]=S;else{if(16===S){for(C=k+2;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m>>>=k,g-=k,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}P=i.lens[i.have-1],w=3+(3&m),m>>>=2,g-=2}else if(17===S){for(C=k+3;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}g-=k,P=0,w=3+(7&(m>>>=k)),m>>>=3,g-=3}else{for(C=k+7;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}g-=k,P=0,w=11+(127&(m>>>=k)),m>>>=7,g-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=P}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,N={bits:i.lenbits},O=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,O){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},O=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,O){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=p&&258<=_){e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,o(e,x),f=e.next_out,c=e.output,_=e.avail_out,d=e.next_in,h=e.input,p=e.avail_in,m=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;E=(L=i.lencode[m&(1<<i.lenbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(E&&!(240&E)){for(R=k,z=E,M=S;E=(L=i.lencode[M+((m&(1<<R+z)-1)>>R)])>>>16&255,S=65535&L,!(R+(k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}m>>>=R,g-=R,i.back+=R}if(m>>>=k,g-=k,i.back+=k,i.length=S,0===E){i.mode=26;break}if(32&E){i.back=-1,i.mode=12;break}if(64&E){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&E,i.mode=22;case 22:if(i.extra){for(C=i.extra;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.length+=m&(1<<i.extra)-1,m>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;E=(L=i.distcode[m&(1<<i.distbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(!(240&E)){for(R=k,z=E,M=S;E=(L=i.distcode[M+((m&(1<<R+z)-1)>>R)])>>>16&255,S=65535&L,!(R+(k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}m>>>=R,g-=R,i.back+=R}if(m>>>=k,g-=k,i.back+=k,64&E){e.msg="invalid distance code",i.mode=30;break}i.offset=S,i.extra=15&E,i.mode=24;case 24:if(i.extra){for(C=i.extra;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.offset+=m&(1<<i.extra)-1,m>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===_)break e;if(w=x-_,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}A=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=c,A=f-i.offset,w=i.length;for(_<w&&(w=_),_-=w,i.length-=w;c[f++]=T[A++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===_)break e;c[f++]=i.length,_--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===p)break e;p--,m|=h[d++]<<g,g+=8}if(x-=_,e.total_out+=x,i.total+=x,x&&(e.adler=i.check=i.flags?s(i.check,c,x,f-x):n(i.check,c,x,f-x)),x=_,(i.flags?m:u(m))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=m=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=m=0}i.mode=29;case 29:O=1;break e;case 30:O=-3;break e;case 31:return-4;default:return l}return e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,(i.wsize||x!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&b(e,e.output,e.next_out,x-e.avail_out)?(i.mode=31,-4):(v-=e.avail_in,x-=e.avail_out,e.total_in+=v,e.total_out+=x,i.total+=x,i.wrap&&x&&(e.adler=i.check=i.flags?s(i.check,c,x,e.next_out-x):n(i.check,c,x,e.next_out-x)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==v&&0===x||4===t)&&0===O&&(O=-5),O)},i.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):l},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?l:11===i.mode&&n(1,t,r,0)!==i.check?-3:b(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):l},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,l,u,h,c,d){var f,p,_,m,g,y,b,v,x,w=d.bits,A=0,T=0,k=0,E=0,S=0,R=0,z=0,M=0,P=0,O=0,N=null,C=0,L=new r.Buf16(16),I=new r.Buf16(16),F=null,D=0;for(A=0;A<=15;A++)L[A]=0;for(T=0;T<l;T++)L[t[i+T]]++;for(S=w,E=15;1<=E&&0===L[E];E--);if(E<S&&(S=E),0===E)return u[h++]=20971520,u[h++]=20971520,d.bits=1,0;for(k=1;k<E&&0===L[k];k++);for(S<k&&(S=k),A=M=1;A<=15;A++)if(M<<=1,(M-=L[A])<0)return-1;if(0<M&&(0===e||1!==E))return-1;for(I[1]=0,A=1;A<15;A++)I[A+1]=I[A]+L[A];for(T=0;T<l;T++)0!==t[i+T]&&(c[I[t[i+T]]++]=T);if(y=0===e?(N=F=c,19):1===e?(N=n,C-=257,F=s,D-=257,256):(N=o,F=a,-1),A=k,g=h,z=T=O=0,_=-1,m=(P=1<<(R=S))-1,1===e&&852<P||2===e&&592<P)return 1;for(;;){for(b=A-z,x=c[T]<y?(v=0,c[T]):c[T]>y?(v=F[D+c[T]],N[C+c[T]]):(v=96,0),f=1<<A-z,k=p=1<<R;u[g+(O>>z)+(p-=f)]=b<<24|v<<16|x,0!==p;);for(f=1<<A-1;O&f;)f>>=1;if(0!==f?(O&=f-1,O+=f):O=0,T++,0==--L[A]){if(A===E)break;A=t[i+c[T]]}if(S<A&&(O&m)!==_){for(0===z&&(z=S),g+=k,M=1<<(R=A-z);R+z<E&&!((M-=L[R+z])<=0);)R++,M<<=1;if(P+=1<<R,1===e&&852<P||2===e&&592<P)return 1;u[_=O&m]=S<<24|R<<16|g-h}}return 0!==O&&(u[g+O]=A-z<<24|64<<16),d.bits=S,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],h=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);n(f);var p=new Array(60);n(p);var _=new Array(512);n(_);var m=new Array(256);n(m);var g=new Array(29);n(g);var y,b,v,x=new Array(a);function w(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?_[e]:_[256+(e>>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,k(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function S(e,t,i){E(e,i[2*t],i[2*t+1])}function R(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function z(e,t,i){var r,n,s=new Array(16),o=0;for(r=1;r<=l;r++)s[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=R(s[a]++,a))}}function M(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function P(e){8<e.bi_valid?k(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function O(e,t,i,r){var n=2*t,s=2*i;return e[n]<e[s]||e[n]===e[s]&&r[t]<=r[i]}function N(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&O(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!O(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function C(e,t,i){var r,n,o,a,l=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],n=e.pending_buf[e.l_buf+l],l++,0===r?S(e,n,t):(S(e,(o=m[n])+s+1,t),0!==(a=u[o])&&E(e,n-=g[o],a),S(e,o=T(--r),i),0!==(a=h[o])&&E(e,r-=x[o],a)),l<e.last_lit;);S(e,256,t)}function L(e,t){var i,r,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,h=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<u;i++)0!==s[2*i]?(e.heap[++e.heap_len]=h=i,e.depth[i]=0):s[2*i+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=h<2?++h:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=h,i=e.heap_len>>1;1<=i;i--)N(e,s,i);for(n=u;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,s[2*n]=s[2*i]+s[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,s[2*i+1]=s[2*r+1]=n,e.heap[1]=n++,N(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,s,o,a,u=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,m=0;for(s=0;s<=l;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)_<(s=u[2*u[2*(r=e.heap[i])+1]+1]+1)&&(s=_,m++),u[2*r+1]=s,h<r||(e.bl_count[s]++,o=0,p<=r&&(o=f[r-p]),a=u[2*r],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(c[2*r+1]+o)));if(0!==m){do{for(s=_-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[_]--,m-=2}while(0<m);for(s=_;0!==s;s--)for(r=e.bl_count[s];0!==r;)h<(n=e.heap[--i])||(u[2*n+1]!==s&&(e.opt_len+=(s-u[2*n+1])*u[2*n],u[2*n+1]=s),r--)}}(e,t),z(s,h,e.bl_count)}function I(e,t,i){var r,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++a<l&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4))}function F(e,t,i){var r,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++a<l&&n===o)){if(a<u)for(;S(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(S(e,n,e.bl_tree),a--),S(e,16,e.bl_tree),E(e,a-3,2)):a<=10?(S(e,17,e.bl_tree),E(e,a-3,3)):(S(e,18,e.bl_tree),E(e,a-11,7));s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4)}}n(x);var D=!1;function U(e,t,i,n){E(e,0+(n?1:0),3),function(e,t,i){P(e),k(e,i),k(e,~i),r.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i)}i._tr_init=function(e){D||(function(){var e,t,i,r,n,s=new Array(16);for(r=i=0;r<28;r++)for(g[r]=i,e=0;e<1<<u[r];e++)m[i++]=r;for(m[i-1]=r,r=n=0;r<16;r++)for(x[r]=n,e=0;e<1<<h[r];e++)_[n++]=r;for(n>>=7;r<a;r++)for(x[r]=n<<7,e=0;e<1<<h[r]-7;e++)_[256+n++]=r;for(t=0;t<=l;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(z(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=R(e,5);y=new w(f,u,257,o,l),b=new w(p,h,0,a,l),v=new w(new Array(0),c,0,19,7)}(),D=!0),e.l_desc=new A(e.dyn_ltree,y),e.d_desc=new A(e.dyn_dtree,b),e.bl_desc=new A(e.bl_tree,v),e.bi_buf=0,e.bi_valid=0,M(e)},i._tr_stored_block=U,i._tr_flush_block=function(e,t,i,r){var n,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),L(e,e.l_desc),L(e,e.d_desc),a=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),L(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?U(e,t,i,r):4===e.strategy||o===n?(E(e,2+(r?1:0),3),C(e,f,p)):(E(e,4+(r?1:0),3),function(e,t,i,r){var n;for(E(e,t-257,5),E(e,i-1,5),E(e,r-4,4),n=0;n<r;n++)E(e,e.bl_tree[2*d[n]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),C(e,e.dyn_ltree,e.dyn_dtree)),M(e),r&&P(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(m[i]+s+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){E(e,2,3),S(e,256,f),function(e){16===e.bi_valid?(k(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];xe.push(new Ee(e,t)),1!==xe.length||we||be(ke)}(function(){c(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){r.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(c,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[s]=n,t(s),s++},u.clearImmediate=h}function h(e){delete o[e]}function c(e){if(a)setTimeout(c,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(undefined,i)}}(t)}finally{h(e),a=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&c(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),ut.exports),ct=e.getDefaultExportFromCjs(ht),dt={},ft={},pt={};function _t(){if(Me)return pt;function e(e){return null==e}return Me=1,pt.isNothing=e,pt.isObject=function(e){return"object"==typeof e&&null!==e},pt.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},pt.repeat=function(e,t){var i,r="";for(i=0;i<t;i+=1)r+=e;return r},pt.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},pt.extend=function(e,t){var i,r,n,s;if(t)for(i=0,r=(s=Object.keys(t)).length;i<r;i+=1)e[n=s[i]]=t[n];return e},pt}function mt(){if(Oe)return Pe;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Oe=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Pe=e}function gt(){if(Ie)return Le;Ie=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];return Le=function(r,n){if(n=n||{},Object.keys(n).forEach(function(i){if(-1===t.indexOf(i))throw new e('Unknown option "'+i+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(e){return e},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.defaultStyle=n.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(i){e[i].forEach(function(e){t[String(e)]=i})}),t}(n.styleAliases||null),-1===i.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')},Le}function yt(){if(De)return Fe;De=1;var e=_t(),t=mt(),i=gt();function r(e,t,i){var n=[];return e.include.forEach(function(e){i=r(e,t,i)}),e[t].forEach(function(e){i.forEach(function(t,i){t.tag===e.tag&&n.push(i)}),i.push(e)}),i.filter(function(e,t){return-1===n.indexOf(t)})}function n(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=r(this,"implicit",[]),this.compiledExplicit=r(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,i={};function r(e){i[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return i}(this.compiledImplicit,this.compiledExplicit)}return n.DEFAULT=null,n.create=function(){var r,s;switch(arguments.length){case 1:r=n.DEFAULT,s=arguments[0];break;case 2:r=arguments[0],s=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(r=e.toArray(r),s=e.toArray(s),!r.every(function(e){return e instanceof n}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!s.every(function(e){return e instanceof i}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new n({include:r,explicit:s})},Fe=n}function bt(){if(je)return Ue;je=1;var e=gt();return Ue=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Ge)return Be;Ge=1;var e=gt();return Be=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function xt(){if($e)return Ve;$e=1;var e=gt();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function wt(){if(We)return qe;We=1;var e=yt();return qe=new e({explicit:[bt(),vt(),xt()]})}function At(){if(He)return Ze;He=1;var e=gt();return Ze=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function Tt(){if(Ye)return Xe;Ye=1;var e=gt();return Xe=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function kt(){if(Ke)return Je;Ke=1;var e=_t(),t=gt();function i(e){return 48<=e&&e<=55}function r(e){return 48<=e&&e<=57}return Je=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,s=e.length,o=0,a=!1;if(!s)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return!0;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(n=e.charCodeAt(o))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!i(e.charCodeAt(o)))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!r(e.charCodeAt(o)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,i,r=e,n=1,s=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r?0:"0"===t?"b"===r[1]?n*parseInt(r.slice(2),2):"x"===r[1]?n*parseInt(r,16):n*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach(function(e){s.unshift(parseInt(e,10))}),r=0,i=1,s.forEach(function(e){r+=e*i,i*=60}),n*r):n*parseInt(r,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Je}function Et(){if(et)return Qe;et=1;var e=_t(),t=gt(),i=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!i.test(e)},construct:function(e){var t,i,r,n;return i="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,n=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){n.unshift(parseFloat(e,10))}),t=0,r=1,n.forEach(function(e){t+=e*r,r*=60}),i*t):i*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,i){var n;if(isNaN(t))switch(i){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(i){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(i){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return n=t.toString(10),r.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})}function St(){if(it)return tt;it=1;var e=yt();return tt=new e({include:[wt()],implicit:[At(),Tt(),kt(),Et()]})}function Rt(){if(nt)return rt;nt=1;var e=yt();return rt=new e({include:[St()]})}function zt(){if(ot)return st;ot=1;var e=gt(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return st=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var i,r,n,s,o,a,l,u,h=0,c=null;if(null===(i=t.exec(e)))throw new Error("Date resolve error");if(r=+i[1],n=+i[2]-1,s=+i[3],!i[4])return new Date(Date.UTC(r,n,s));if(o=+i[4],a=+i[5],l=+i[6],i[7]){for(h=i[7].slice(0,3);h.length<3;)h+="0";h=+h}return i[9]&&(c=6e4*(60*+i[10]+ +(i[11]||0)),"-"===i[9]&&(c=-c)),u=new Date(Date.UTC(r,n,s,o,a,l,h)),c&&u.setTime(u.getTime()-c),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Mt(){if(lt)return at;lt=1;var e=gt();return at=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Pt,Ot,Nt,Ct,Lt,It,Ft,Dt,Ut,jt,Bt,Gt,Vt,$t,qt,Wt,Zt,Ht,Xt,Yt,Jt,Kt,Qt=e.getAugmentedNamespace(pe);function ei(){if(Ot)return Pt;Ot=1;var e=Qt.Buffer,t=gt(),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Pt=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,s=e.length,o=i;for(r=0;r<s;r++)if(!((t=o.indexOf(e.charAt(r)))>64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(t){var r,n,s=t.replace(/[\r\n=]/g,""),o=s.length,a=i,l=0,u=[];for(r=0;r<o;r++)r%4==0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(s.charAt(r));return 0==(n=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,r,n="",s=0,o=e.length,a=i;for(t=0;t<o;t++)t%3==0&&t&&(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]),s=(s<<8)+e[t];return 0==(r=o%3)?(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]):2===r?(n+=a[s>>10&63],n+=a[s>>4&63],n+=a[s<<2&63],n+=a[64]):1===r&&(n+=a[s>>2&63],n+=a[s<<4&63],n+=a[64],n+=a[64]),n}}),Pt}function ti(){if(Ct)return Nt;Ct=1;var e=gt(),t=Object.prototype.hasOwnProperty,i=Object.prototype.toString;return Nt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,n,s,o,a,l=[],u=e;for(r=0,n=u.length;r<n;r+=1){if(s=u[r],a=!1,"[object Object]"!==i.call(s))return!1;for(o in s)if(t.call(s,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),Nt}function ii(){if(It)return Lt;It=1;var e=gt(),t=Object.prototype.toString;return Lt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var i,r,n,s,o,a=e;for(o=new Array(a.length),i=0,r=a.length;i<r;i+=1){if(n=a[i],"[object Object]"!==t.call(n))return!1;if(1!==(s=Object.keys(n)).length)return!1;o[i]=[s[0],n[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,i,r,n,s,o=e;for(s=new Array(o.length),t=0,i=o.length;t<i;t+=1)r=o[t],n=Object.keys(r),s[t]=[n[0],r[n[0]]];return s}}),Lt}function ri(){if(Dt)return Ft;Dt=1;var e=gt(),t=Object.prototype.hasOwnProperty;return Ft=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var i,r=e;for(i in r)if(t.call(r,i)&&null!==r[i])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function ni(){if(jt)return Ut;jt=1;var e=yt();return Ut=new e({include:[Rt()],implicit:[zt(),Mt()],explicit:[ei(),ti(),ii(),ri()]})}function si(){if(Gt)return Bt;Gt=1;var e=gt();return Bt=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function oi(){if($t)return Vt;$t=1;var e=gt();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,i=/\/([gim]*)$/.exec(e),r="";if("/"===t[0]){if(i&&(r=i[1]),r.length>3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,i=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(i&&(r=i[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function ai(){if(Wt)return qt;var e;Wt=1;try{e=Re("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=gt();return qt=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var i="("+t+")",r=e.parse(i,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&"FunctionExpression"===r.body[0].expression.type}catch(e){return!1}},construct:function(t){var i,r="("+t+")",n=e.parse(r,{range:!0}),s=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach(function(e){s.push(e.name)}),i=n.body[0].expression.body.range,new Function(s,r.slice(i[0]+1,i[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function li(){if(Ht)return Zt;Ht=1;var e=yt();return Zt=e.DEFAULT=new e({include:[ni()],explicit:[si(),oi(),ai()]})}var ui=function(){if(Kt)return Jt;Kt=1;var e=function(){if(Yt)return dt;Yt=1;var e=function(){if(Xt)return ft;Xt=1;var e=_t(),t=mt(),i=function(){if(Ce)return Ne;Ce=1;var e=_t();function t(e,t,i,r,n){this.name=e,this.buffer=t,this.position=i,this.line=r,this.column=n}return t.prototype.getSnippet=function(t,i){var r,n,s,o,a;if(!this.buffer)return null;for(t=t||4,i=i||75,r="",n=this.position;n>0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>i/2-1){r=" ... ",n+=5;break}for(s="",o=this.position;o<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>i/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),e.repeat(" ",t)+r+a+s+"\n"+e.repeat(" ",t+this.position-n+r.length)+"^"},t.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(i+=":\n"+t),i},Ne=t}(),r=ni(),n=li(),s=Object.prototype.hasOwnProperty,o=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,h=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function c(e){return 10===e||13===e}function d(e){return 9===e||32===e}function f(e){return 9===e||32===e||10===e||13===e}function p(e){return 44===e||91===e||93===e||123===e||125===e}function _(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function m(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function g(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),b=new Array(256),v=0;v<256;v++)y[v]=m(v)?1:0,b[v]=m(v);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||n,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,r){return new t(r,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function A(e,t){throw w(e,t)}function T(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var k={YAML:function(e,t,i){var r,n,s;null!==e.version&&A(e,"duplication of %YAML directive"),1!==i.length&&A(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&A(e,"ill-formed argument of the YAML directive"),n=parseInt(r[1],10),s=parseInt(r[2],10),1!==n&&A(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&T(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var r,n;2!==i.length&&A(e,"TAG directive accepts exactly two arguments"),r=i[0],n=i[1],u.test(r)||A(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,r)&&A(e,'there is a previously declared suffix for "'+r+'" tag handle'),h.test(n)||A(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=n}};function E(e,t,i,r){var n,s,a,l;if(t<i){if(l=e.input.slice(t,i),r)for(n=0,s=l.length;n<s;n+=1)9===(a=l.charCodeAt(n))||32<=a&&a<=1114111||A(e,"expected valid JSON character");else o.test(l)&&A(e,"the stream contains non-printable characters");e.result+=l}}function S(t,i,r,n){var o,a,l,u;for(e.isObject(r)||A(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(o=Object.keys(r)).length;l<u;l+=1)a=o[l],s.call(i,a)||(i[a]=r[a],n[a]=!0)}function R(e,t,i,r,n,o){var a,l;if(n=String(n),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)S(e,t,o[a],i);else S(e,t,o,i);else e.json||s.call(i,n)||!s.call(t,n)||A(e,"duplicated mapping key"),t[n]=o,delete i[n];return t}function z(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):A(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function M(e,t,i){for(var r=0,n=e.input.charCodeAt(e.position);0!==n;){for(;d(n);)n=e.input.charCodeAt(++e.position);if(t&&35===n)do{n=e.input.charCodeAt(++e.position)}while(10!==n&&13!==n&&0!==n);if(!c(n))break;for(z(e),n=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===n;)e.lineIndent++,n=e.input.charCodeAt(++e.position)}return-1!==i&&0!==r&&e.lineIndent<i&&T(e,"deficient indentation"),r}function P(e){var t,i=e.position;return!(45!==(t=e.input.charCodeAt(i))&&46!==t||t!==e.input.charCodeAt(i+1)||t!==e.input.charCodeAt(i+2)||(i+=3,0!==(t=e.input.charCodeAt(i))&&!f(t)))}function O(t,i){1===i?t.result+=" ":i>1&&(t.result+=e.repeat("\n",i-1))}function N(e,t){var i,r,n=e.tag,s=e.anchor,o=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),r=e.input.charCodeAt(e.position);0!==r&&45===r&&f(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,M(e,!0,-1)&&e.lineIndent<=t)o.push(null),r=e.input.charCodeAt(e.position);else if(i=e.line,I(e,t,3,!1,!0),o.push(e.result),M(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>t)&&0!==r)A(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=n,e.anchor=s,e.kind="sequence",e.result=o,!0)}function C(e){var t,i,r,n,o=!1,a=!1;if(33!==(n=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&A(e,"duplication of a tag property"),60===(n=e.input.charCodeAt(++e.position))?(o=!0,n=e.input.charCodeAt(++e.position)):33===n?(a=!0,i="!!",n=e.input.charCodeAt(++e.position)):i="!",t=e.position,o){do{n=e.input.charCodeAt(++e.position)}while(0!==n&&62!==n);e.position<e.length?(r=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):A(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==n&&!f(n);)33===n&&(a?A(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),u.test(i)||A(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),n=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),l.test(r)&&A(e,"tag suffix cannot contain flow indicator characters")}return r&&!h.test(r)&&A(e,"tag name cannot contain such characters: "+r),o?e.tag=r:s.call(e.tagMap,i)?e.tag=e.tagMap[i]+r:"!"===i?e.tag="!"+r:"!!"===i?e.tag="tag:yaml.org,2002:"+r:A(e,'undeclared tag handle "'+i+'"'),!0}function L(e){var t,i;if(38!==(i=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&A(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!f(i)&&!p(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function I(t,i,r,n,o){var a,l,u,h,m,v,x,w,T=1,k=!1,S=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===r||3===r,n&&M(t,!0,-1)&&(k=!0,t.lineIndent>i?T=1:t.lineIndent===i?T=0:t.lineIndent<i&&(T=-1)),1===T)for(;C(t)||L(t);)M(t,!0,-1)?(k=!0,u=a,t.lineIndent>i?T=1:t.lineIndent===i?T=0:t.lineIndent<i&&(T=-1)):u=!1;if(u&&(u=k||o),1!==T&&4!==r||(x=1===r||2===r?i:i+1,w=t.position-t.lineStart,1===T?u&&(N(t,w)||function(e,t,i){var r,n,s,o,a=e.tag,l=e.anchor,u={},h={},c=null,p=null,_=null,m=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),o=e.input.charCodeAt(e.position);0!==o;){if(r=e.input.charCodeAt(e.position+1),s=e.line,63!==o&&58!==o||!f(r)){if(!I(e,i,2,!1,!0))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);d(o);)o=e.input.charCodeAt(++e.position);if(58===o)f(o=e.input.charCodeAt(++e.position))||A(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(R(e,u,h,c,p,null),c=p=_=null),g=!0,m=!1,n=!1,c=e.tag,p=e.result;else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===o?(m&&(R(e,u,h,c,p,null),c=p=_=null),g=!0,m=!0,n=!0):m?(m=!1,n=!0):A(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=r;if((e.line===s||e.lineIndent>t)&&(I(e,t,4,!0,n)&&(m?p=e.result:_=e.result),m||(R(e,u,h,c,p,_),c=p=_=null),M(e,!0,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)A(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&R(e,u,h,c,p,null),g&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),g}(t,w,x))||function(e,t){var i,r,n,s,o,a,l,u,h,c,d=!0,p=e.tag,_=e.anchor,m={};if(91===(c=e.input.charCodeAt(e.position)))n=93,a=!1,r=[];else{if(123!==c)return!1;n=125,a=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),c=e.input.charCodeAt(++e.position);0!==c;){if(M(e,!0,t),(c=e.input.charCodeAt(e.position))===n)return e.position++,e.tag=p,e.anchor=_,e.kind=a?"mapping":"sequence",e.result=r,!0;d||A(e,"missed comma between flow collection entries"),h=null,s=o=!1,63===c&&f(e.input.charCodeAt(e.position+1))&&(s=o=!0,e.position++,M(e,!0,t)),i=e.line,I(e,t,1,!1,!0),u=e.tag,l=e.result,M(e,!0,t),c=e.input.charCodeAt(e.position),!o&&e.line!==i||58!==c||(s=!0,c=e.input.charCodeAt(++e.position),M(e,!0,t),I(e,t,1,!1,!0),h=e.result),a?R(e,r,m,u,l,h):s?r.push(R(e,null,m,u,l,h)):r.push(l),M(e,!0,t),44===(c=e.input.charCodeAt(e.position))?(d=!0,c=e.input.charCodeAt(++e.position)):d=!1}A(e,"unexpected end of the stream within a flow collection")}(t,x)?S=!0:(l&&function(t,i){var r,n,s,o,a,l=1,u=!1,h=i,f=0,p=!1;if(124===(o=t.input.charCodeAt(t.position)))n=!1;else{if(62!==o)return!1;n=!0}for(t.kind="scalar",t.result="";0!==o;)if(43===(o=t.input.charCodeAt(++t.position))||45===o)1===l?l=43===o?3:2:A(t,"repeat of a chomping mode identifier");else{if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?A(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?A(t,"repeat of an indentation width identifier"):(h=i+s-1,u=!0)}if(d(o)){do{o=t.input.charCodeAt(++t.position)}while(d(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!c(o)&&0!==o)}for(;0!==o;){for(z(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<h)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>h&&(h=t.lineIndent),c(o))f++;else{if(t.lineIndent<h){3===l?t.result+=e.repeat("\n",f):1===l&&u&&(t.result+="\n");break}for(n?d(o)?(p=!0,t.result+=e.repeat("\n",f+1)):p?(p=!1,t.result+=e.repeat("\n",f+1)):0===f?u&&(t.result+=" "):t.result+=e.repeat("\n",f):t.result+=u?e.repeat("\n",f+1):e.repeat("\n",f),u=!0,f=0,r=t.position;!c(o)&&0!==o;)o=t.input.charCodeAt(++t.position);E(t,r,t.position,!1)}}return!0}(t,x)||function(e,t){var i,r,n;if(39!==(i=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(i=e.input.charCodeAt(e.position));)if(39===i){if(E(e,r,e.position,!0),39!==(i=e.input.charCodeAt(++e.position)))return!0;r=n=e.position,e.position++}else c(i)?(E(e,r,n,!0),O(e,M(e,!1,t)),r=n=e.position):e.position===e.lineStart&&P(e)?A(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);A(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var i,r,n,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return E(e,i,e.position,!0),e.position++,!0;if(92===a){if(E(e,i,e.position,!0),c(a=e.input.charCodeAt(++e.position)))M(e,!1,t);else if(a<256&&y[a])e.result+=b[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(n=o,s=0;n>0;n--)(o=_(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:A(e,"expected hexadecimal character");e.result+=g(s),e.position++}else A(e,"unknown escape sequence");i=r=e.position}else c(a)?(E(e,i,r,!0),O(e,M(e,!1,t)),i=r=e.position):e.position===e.lineStart&&P(e)?A(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}A(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?S=!0:function(e){var t,i,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!f(r)&&!p(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an alias node must contain at least one character"),i=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(i)||A(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],M(e,!0,-1),!0}(t)?(S=!0,null===t.tag&&null===t.anchor||A(t,"alias node should not have any properties")):function(e,t,i){var r,n,s,o,a,l,u,h,_=e.kind,m=e.result;if(f(h=e.input.charCodeAt(e.position))||p(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return!1;if((63===h||45===h)&&(f(r=e.input.charCodeAt(e.position+1))||i&&p(r)))return!1;for(e.kind="scalar",e.result="",n=s=e.position,o=!1;0!==h;){if(58===h){if(f(r=e.input.charCodeAt(e.position+1))||i&&p(r))break}else if(35===h){if(f(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&P(e)||i&&p(h))break;if(c(h)){if(a=e.line,l=e.lineStart,u=e.lineIndent,M(e,!1,-1),e.lineIndent>=t){o=!0,h=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(E(e,n,s,!1),O(e,e.line-a),n=s=e.position,o=!1),d(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return E(e,n,s,!1),!!e.result||(e.kind=_,e.result=m,!1)}(t,x,1===r)&&(S=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===T&&(S=u&&N(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(h=0,m=t.implicitTypes.length;h<m;h+=1)if((v=t.implicitTypes[h]).resolve(t.result)){t.result=v.construct(t.result),t.tag=v.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(v=t.typeMap[t.tag],null!==t.result&&v.kind!==t.kind&&A(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+v.kind+'", not "'+t.kind+'"'),v.resolve(t.result)?(t.result=v.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):A(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):A(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||S}function F(e){var t,i,r,n,o=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(n=e.input.charCodeAt(e.position))&&(M(e,!0,-1),n=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==n));){for(l=!0,n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!f(n);)n=e.input.charCodeAt(++e.position);for(r=[],(i=e.input.slice(t,e.position)).length<1&&A(e,"directive name must not be less than one character in length");0!==n;){for(;d(n);)n=e.input.charCodeAt(++e.position);if(35===n){do{n=e.input.charCodeAt(++e.position)}while(0!==n&&!c(n));break}if(c(n))break;for(t=e.position;0!==n&&!f(n);)n=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==n&&z(e),s.call(k,i)?k[i](e,i,r):T(e,'unknown document directive "'+i+'"')}M(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,M(e,!0,-1)):l&&A(e,"directives end mark is expected"),I(e,e.lineIndent-1,4,!1,!0),M(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&T(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&P(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,M(e,!0,-1)):e.position<e.length-1&&A(e,"end of the stream or a document separator is expected")}function D(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var i=new x(e,t);for(i.input+="\0";32===i.input.charCodeAt(i.position);)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)F(i);return i.documents}function U(e,t,i){var r,n,s=D(e,i);for(r=0,n=s.length;r<n;r+=1)t(s[r])}function j(e,i){var r=D(e,i);if(0!==r.length){if(1===r.length)return r[0];throw new t("expected a single document in the stream, but found more")}}return ft.loadAll=U,ft.load=j,ft.safeLoadAll=function(t,i,n){U(t,i,e.extend({schema:r},n))},ft.safeLoad=function(t,i){return j(t,e.extend({schema:r},i))},ft}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return dt.Type=gt(),dt.Schema=yt(),dt.FAILSAFE_SCHEMA=wt(),dt.JSON_SCHEMA=St(),dt.CORE_SCHEMA=Rt(),dt.DEFAULT_SAFE_SCHEMA=ni(),dt.DEFAULT_FULL_SCHEMA=li(),dt.load=e.load,dt.loadAll=e.loadAll,dt.safeLoad=e.safeLoad,dt.safeLoadAll=e.safeLoadAll,dt.YAMLException=mt(),dt.MINIMAL_SCHEMA=wt(),dt.SAFE_SCHEMA=ni(),dt.DEFAULT_SCHEMA=li(),dt.scan=t("scan"),dt.parse=t("parse"),dt.compose=t("compose"),dt.addConstructor=t("addConstructor"),dt}();return Jt=e}(),hi=e.getDefaultExportFromCjs(ui);class ci{constructor(t,i,r=null){this.url=t,!i||e.isRelativeURL(i)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=i,this.path_for_parent=i||this.path,this.parent=r,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return fi(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return h(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class di extends ci{constructor(e,t,i){super(e,t,i),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return h(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),fi(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],i=[];this.zip.forEach((e,r)=>{r.dir||(t.push(e),i.push(r.async("arraybuffer")))});const r=await Promise.all(i);for(let i=0;i<r.length;i++){let n=t[i],s=n.split("/").length-1;this.files[n]={data:r[i],type:e.extensionForURL(n),depth:s}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function fi(t){return new Promise((i,r)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{i(function(e){return hi.safeLoad(e,{json:!0})}(e))}catch(e){r(e)}},r):(t=Object.assign({},t),i(t))})}const pi={async loadScene(t,{path:i,type:r}={}){const n=[],s={},o=await this.loadSceneRecursive({url:t,path:i,type:r},null,s,n),{config:a,bundle:l}=this.finalize(o);if(!a)throw n[0];return n.length>0&&n.forEach(t=>{const i=`Failed to import scene: ${t.url}`;e.log("error",i,t),this.trigger("error",{type:"scene_import",message:i,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:i,type:r},n,s={},o=[]){if(!t)return{};const a=function(t,i,r,n=null){return null!=n&&"zip"===n||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new di(t,i,r):new ci(t,i,r)}(t,i,n,r);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,s),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const i=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),i.push(a.resourceFor(t))}),delete t.import;const r=i.map(e=>this.loadSceneRecursive(e,a,s,o)),n=(await Promise.all(r)).map(e=>this.normalize(e.config,e.bundle,s)).map(e=>e.config);return this.normalize(t,a,s),t=e.mergeObjects(...n,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,i={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,i),{config:e,bundle:t,texture_nodes:i}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const i in e.sources)this.normalizeDataSource(e.sources[i],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const i in e.scripts)e.scripts[i]=t.urlFor(e.scripts[i])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const i=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of i)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const i in e.textures){const r=e.textures[i];r.url&&(r.url=t.urlFor(r.url))}},collectTextures(t,i,r){if(t.styles)for(const e in t.styles){const n=t.styles[e],s=n.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,i,r)}n.material&&["emission","ambient","diffuse","specular","normal"].forEach(s=>{const o=null!=n.material[s]&&n.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,i,r)}})}if(t.styles)for(const n in t.styles){const s=t.styles[n];s.shaders&&s.shaders.uniforms&&e.GLSL.parseUniforms(s.shaders.uniforms).forEach(({type:e,value:s,path:o})=>{if("sampler2D"===e&&"string"==typeof s&&!t.textures[s]){const e=["styles",n,"shaders","uniforms",...o];this.addTextureNode(e,i,r)}})}if(t.layers){const n=[t.layers],s=[["layers"]];for(;n.length>0;){const o=n.pop(),a=s.pop();if("object"==typeof o&&!Array.isArray(o))for(const l in o)if("draw"===l){const e=o[l];for(const n in e){if(e[n].texture){const s=e[n].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"texture"];this.addTextureNode(e,i,r)}}if(e[n].outline&&e[n].outline.texture){const s=e[n].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"outline","texture"];this.addTextureNode(e,i,r)}}}}else{if(e.isReserved(l))continue;n.push(o[l]),s.push([...a,l])}}}},addTextureNode(e,t,i){i[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,i={}){for(const{path:r,bundle:n}of Object.values(i)){const i=s(e,r);if("string"==typeof i&&null==e.textures[i])if(c(e,r)){const r=t.urlFor(i);e.textures[i]={url:r}}else{const t=n.urlFor(i);e.textures[t]={url:t},o(e,r,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?f(d(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(pi);class _i{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let i=0;for(;i<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;i++}}getDescendants(t,i=0){let r=[];if(i<this.max_proxy_descendant_depth){let n=e.TileID.children(t,this.children_cache);if(!n)return;n.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?r.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&r.push(...this.getDescendants(e,i+1)))})}return r}}let mi={},gi={};function yi(t,i=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,i);if(this.obbs)for(let r=0;r<this.obbs.length;r++){let n={aabb:this.aabbs[r],obb:this.obbs[r]};if(e.Label.prototype.occluded.call(n,t,i))return!0}return!1}class bi{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new _i,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var i=this.tiles[t];null!=i&&i.destroy(),this.forgetTile(i.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let i in this.tiles)e(this.tiles[i])&&t.push(i);for(let e=0;e<t.length;e++){let i=t[e];this.removeTile(i)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const i=e[t];this.queueCoordinate(i),this.visible_coords[i.key]=i}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const i=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===i.length?Promise.resolve({}):(i.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===vi(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(i.map(e=>e.key))&&this.collision.mesh_set===xi(i)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=vi(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(i.map(e=>e.key)),this.collision.mesh_set=xi(i),this.collision.task={type:"tileManagerUpdateLabels",run:async function(r){const n=await async function(t,i,r=!1){gi=mi,mi={};let n=function(t,i){let r={};t.forEach(t=>{const n=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,i-t.style_z),o=n*s,a=e.Geo.metersPerPixel(i),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let i in l)l[i].forEach(i=>{if(i.labels)for(let s in i.labels){if(t.isProxy()&&!gi[s])continue;const l=i.labels[s].container.label,u=i.labels[s].container.linked,h=i.labels[s].ranges;let c={};if(c.discard=yi.bind(c),c.build_id=t.build_id,Object.assign(c,l),c.layout=Object.assign({},l.layout),c.layout.repeat_scale=.75,c.layout.repeat_distance=c.layout.repeat_distance||0,c.layout.repeat_distance/=o,c.position=[c.position[0]/n+t.min.x,c.position[1]/n+t.min.y],c.unit_scale=a,"point"===c.type)e.LabelPoint.prototype.updateBBoxes.call(c);else if("straight"===c.type)e.LabelLineStraight.prototype.updateBBoxes.call(c,c.position,c.size,c.angle,c.angle,c.offset);else if(l.obbs){const i=l.obbs.map(i=>{let{x:r,y:s,a:a,w:l,h:u}=i;return r=r/n+t.min.x,s=s/n+t.min.y,l/=o,u/=o,new e.OBB(r,s,a,l,u)});c.obbs=i,c.aabbs=i.map(e=>e.getExtent())}r[s]={label:c,linked:u,ranges:h,mesh:i}}})});for(let e in r){const t=r[e];t.linked&&(t.linked=r[t.linked])}return r=Object.keys(r).map(e=>r[e]),r}(t,i);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const s=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),o=Math.floor(s/e.Geo.tile_size);o>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/o}):e.Collision.initGrid();const a=await e.Collision.collide(n,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||r&&e.label.breach&&!gi[e.label.id]||(t=1),t&&(mi[e.label.id]=!0);let i=!0;e.ranges.forEach(r=>{if(!i)return;let n=e.mesh;if(!n.valid)return;let s=n.vertex_layout.offset.a_shape,o=n.vertex_layout.stride;for(let e=0;e<r[1];e++){if(n.vertex_data[r[0]+e*o+s+6]===t)return void(i=!1);n.vertex_data[r[0]+e*o+s+6]=t}-1===l.indexOf(n)&&l.push(n)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:n}}(i,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(r,n),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const i=this.pyramid.getAncestor(t);if(i)i.setProxyFor(t),e=!0;else{const i=this.pyramid.getDescendants(t);for(let r=0;r<i.length;r++)i[r].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let i in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[i])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,i)=>{let r=this.view.center.meters,n=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=n,s.y-=n;let o=e.Geo.metersForTile(i);o.x+=n,o.y-=n;let a=Math.abs(r.x-s.x)+Math.abs(r.y-s.y),l=Math.abs(r.x-o.x)+Math.abs(r.y-o.y);return t.center_dist=a,i.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let i in this.scene.sources){let r=this.scene.sources[i];if(!r.builds_geometry_tiles||!r.includesTile(t,this.view.tile_zoom))continue;let n=e.TileID.normalizedKey(t,r,this.view.tile_zoom);if(n&&!this.hasTile(n)){e.log("trace",`load tile ${n}, distance from view center: ${t.center_dist}`);let i=new e.Tile({source:r,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(i),this.buildTile(i)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:i}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}i.done&&(t.built=!0),t.buildMeshes(this.scene.styles,i),this.updateTileStates(),this.scene.requestRedraw()}i.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var i=[];for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||i.push(this.tiles[r].debug[e]);return i}getDebugSum(e,t){var i=0;for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||(i+=this.tiles[r].debug[e]);return i}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function vi(e,t,i=2){return(Math.floor(e*t)/t).toFixed(i)}function xi(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class wi{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class Ai{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new wi({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new wi({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new wi({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new wi({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Ti{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,i=this.canvas.height,r=new Uint8Array(t*i*4);this.gl.readPixels(0,0,t,i,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r);let n=this.queue_screenshot.background;n=n&&"transparent"!==n?e.StyleParser.parseColor(n).slice(0,3).map(e=>255*e):null;let s=new Uint8ClampedArray(t*i*4);for(let e=0;e<i;e++)for(let o=0;o<t;o++){let a=4*((i-e-1)*t+o),l=4*(e*t+o),u=r[a+3];s[l+0]=255*r[a+0]/u,s[l+1]=255*r[a+1]/u,s[l+2]=255*r[a+2]/u,s[l+3]=u,n&&(u/=255,s[l+0]=s[l+0]*u+n[0]*(1-u),s[l+1]=s[l+1]*u+n[1]*(1-u),s[l+2]=s[l+2]*u+n[2]*(1-u),s[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let o=this.screenshot_canvas;o.width=t,o.height=i,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,i);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),h=atob(u.slice(22)),c=new Uint8Array(h.length);for(let e=0;e<h.length;++e)c[e]=h.charCodeAt(e);const d=new Blob([c],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:d,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=i=>{if(i.data.size>0&&t.chunks.push(i.data),t.resolve){let i=new Blob(t.chunks,{type:t.options.mimeType}),r=e.createObjectURL(i);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:r,blob:i,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function ki(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Ei(t){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?ki(Object(r),!0).forEach(function(i){e._defineProperty(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ki(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}class Si{constructor(t,i){var r;i=i||{},e.subscribeMixin(this),this.id=Si.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,i),this.tile_manager=new bi({scene:this}),this.num_workers=i.numWorkers||2,!0===i.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===i.highDensityDisplay||i.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,i.preUpdate&&this.subscribe({pre_update:i.preUpdate}),i.postUpdate&&this.subscribe({post_update:i.postUpdate}),this.render_loop=!i.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Ti,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===i.introspection,this.times={},this.resetTime(),this.container=i.container,this.canvas=null,this.contextOptions=i.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Si.generation,this.last_complete_generation=Si.generation,(r=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profileEnd",t)},timeRebuild(t=1,i={}){let n=[],s=()=>{let o=+new Date;r.rebuild(i).then(()=>{if(n.push(+new Date-o),n.length<t)s();else{let i=~~(n.reduce((e,t)=>e+t)/n.length);e.log("info",`Profiled rebuild ${t} times: ${i} avg (${Math.min(...n)} min, ${Math.max(...n)} max)`)}})};s()},geometryCountByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let i in t.meshes)e[i]=e[i]||0,t.meshes[i].forEach(t=>{e[i]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=r.debug.geometryCountByStyle(),t={};for(let i in e){let n=r.styles[i].baseStyle();t[n]=t[n]||0,t[n]+=e[i]}return t},geometryCountTotal(){const e=r.debug.geometryCountByStyle();return Object.keys(e).reduce((t,i)=>e[i]+t,0)},geometrySizeByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let i in t.meshes)e[i]=e[i]||0,t.meshes[i].forEach(t=>{e[i]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=r.debug.geometrySizeByStyle(),t={};for(let i in e){let n=r.styles[i].baseStyle();t[n]=t[n]||0,t[n]+=e[i]}return t},geometrySizeTotal(){const e=r.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,i)=>e[i]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(r.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>r.tile_manager.getRenderableTiles().length},this.log_level=i.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new Si(e,t)}load(t=null,i={}){var r=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(i="string"==typeof i?{base_path:i}:i).blocking=void 0===i.blocking||i.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,i).then(async function({texture_nodes:t}){await r.createWorkers(),r.destroyFeatureSelection(),e.WorkerBroker.postMessage(r.workers,"self.clearFunctionStringCache");const n="object"==typeof r.config_source||r.hasSubscribersFor("load"),s=r.updateConfig({texture_nodes:t,serialize_funcs:n,normalize:!1,loading:!0,fade_in:!0});!0===i.blocking&&await s,r.freePreviousTextures(),r.updating--,r.initializing=null,r.initialized=!0,r.last_valid_config_source=r.config_source,r.last_valid_options={base_path:i.base_path,file_type:i.file_type},r.requestRedraw()}).catch(t=>{let i,r;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(i="yaml",r="Error parsing scene YAML"):r="Error initializing scene",this.trigger("error",{type:i,message:r,error:t,url:this.config_source}),r=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",r,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",r,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=r.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new Ai(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let i=this.config.sources[e];if(i.scripts)for(let e in i.scripts)-1===t.indexOf(i.scripts[e])&&t.push(i.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,i)=>t===e[i]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),r=[];this.workers=[];for(let n=0;n<this.num_workers;n++){let s=new Worker(i.workerURL);this.workers[n]=s,e.WorkerBroker.addWorker(s),e.log("debug",`Scene.makeWorkers: initializing worker ${n}`);let o=n;r.push(e.WorkerBroker.postMessage(s,"self.init",this.id,n,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${o}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(r).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,i){0===t&&0===i||(this.dirty=!0,this.view.setViewportSize(t,i),this.gl&&r.resize(this.gl,t,i,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,i=!!this.selection&&this.selection.hasPendingRequests();var r=!(!1===t&&!1===i||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",r),this.view.update(),!!r&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:i}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",r),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:i}){var r=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),i){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,this.canvas.width,this.canvas.height),r.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:i}={}){i=null==i||i,this.clearFrame();let r,n=0;const s=this.style_manager.getActiveBlendOrders();for(const{blend_order:o,styles:a}of s)for(let s=0;s<a.length;s++){let l=this.styles[a[s]];if(null==l)continue;if(l.blend!==r){let t=Object.assign({},e.Style.render_states[l.blend],{blend:i&&l.blend});this.setRenderState(t)}const u=i&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,o),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),n+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let i=0;i<e.length;i++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-i,255),n+=this.renderStyle(l.name,t,o,e[i]);this.gl.disable(this.gl.STENCIL_TEST)}else n+=this.renderStyle(l.name,t,o)}else n+=this.renderStyle(l.name,t,o);r=l.blend}return n}renderStyle(e,t,i,r=null){let n,s=this.styles[e],o=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof r||e.proxy_level===r).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===i)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let i=0;i<u+1;i++)for(let[r,u]of l){let l=!0;if(!r.shouldProxyForStyle(e))continue;const h=u.filter(e=>e.variant.mesh_order===i);if(0!==h.length){if(!0===o&&(o=!1,n=this.setupStyle(s,t),!n))return 0;h.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(r,n)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let i;try{if(i=e.getProgram(t),!i)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}i.use(),e.setup(),i.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(i);for(let e in this.lights)this.lights[e].setupProgram(i);return i}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:i,blend:r}={}){if(!this.initialized)return;let n=this.render_states;e=!1!==e&&n.defaults.depth_test,t=!1!==t&&n.defaults.depth_write,i=!1!==i&&n.defaults.culling,r=null!=r?r:n.defaults.blending;let s=this.gl;n.depth_test.set({depth_test:e}),n.depth_write.set({depth_write:t}),n.culling.set({cull:i,face:n.defaults.culling_face}),r?"opaque"===r?n.blending.set({blend:!1}):"overlay"===r||"inlay"===r||"translucent"===r?n.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===r?n.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===r&&n.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):n.blending.set({blend:!1})}getFeatureAt(t,{radius:i}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let r={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return i=i>0?{x:i/this.view.size.css.width,y:i/this.view.size.css.height}:null,this.selection.getFeatureAt(r,{radius:i}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:i=!0,group_by:r=null,visible:n=null,geometry:s=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const o=!0===(i="string"==typeof i?[i]:i)||Array.isArray(i)&&i.indexOf("$id")>-1,a=i&&(t=>{const r=Array.isArray(i)?e.sliceObject(t.properties,i):t.properties,n=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:r,id:n}):JSON.stringify({properties:r,id:n})}),l=(r=("string"==typeof r||Array.isArray(r))&&r)&&(t=>Array.isArray(r)?JSON.stringify(e.sliceObject(t,r)):t[r]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),h=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:n,geometry:s,tile_keys:u}),c=[],d={},f={};return h.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(d[t])return;d[t]=!0}if(l){const t=l(e.properties);f[t]=f[t]||[],f[t].push(e)}else c.push(e)})),l?f:c}rebuild({initial:t=!1,new_generation:i=!0,sources:r=null,serialize_funcs:n,profile:s=!1,fade_in:o=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:i,sources:r,serialize_funcs:n,profile:s,fade_in:o};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},s&&this.debug.profile("Scene.rebuild"),i){this.generation=++Si.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:n}),this.resetWorkerFeatureSelection(r),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!r||r.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:o})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{s&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:i,file_type:r}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(i||this.config_source):this.base_path=e.pathForURL(i),this.config_path=this.base_path;const{config:n,bundle:s,texture_nodes:o}=await pi.loadScene(this.config_source,{path:this.base_path,type:r});return this.config=n,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,i){if(!t||!i||!i.type||!i.url&&!i.data)return void e.log("error","No name provided or not a valid config:",t,i);let r=null==this.config.sources[t],n=this.config.sources[t]=Object.assign({},i);return n.data&&"object"==typeof n.data&&(n.url=e.createObjectURL(new Blob([JSON.stringify(n.data)],{type:"application/json"})),delete n.data),r?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const i=[],r=Object.keys(this.sources);let n=0;for(var s in this.config.sources){const r=this.config.sources[s],o=this.sources[s];try{const t=Ei(Ei({},r),{},{name:s,id:n++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw{}}catch(t){delete this.sources[s];const i=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${i}`,r),this.trigger("warning",{type:"sources",source:r,message:i})}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&i.push(s)}r.forEach(e=>{this.config.sources[e]||(delete this.sources[e],i.push(e))}),i.length>0&&this.tile_manager.removeTiles(e=>i.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let i=this.config.lights[t];i.name=t.replace("-","_"),i.visible=!1!==i.visible,i.visible&&(this.lights[i.name]=e.Light.create(this.view,i))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,i=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!i.some((e,i)=>t[i]!==e)||(1===i[3]?this.canvas.style.backgroundColor=`rgba(${i.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...i))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:i=!0,serialize_funcs:r,texture_nodes:n={},normalize:s=!0,fade_in:o=!1}={}){this.generation=++Si.generation,this.updating++,this.config=pi.applyGlobalProperties(this.config),s&&pi.normalize(this.config,this.config_bundle,n),pi.hoistTextureNodes(this.config,this.config_bundle,n),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=i?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:r,fade_in:o},"object"==typeof i&&i)):this.syncConfigToWorker({serialize_funcs:r});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let i=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:i,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},pi.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),pi.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var Ri;Si.id=0,Si.generation=0;const zi={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Mi={leafletLayer:function(t){return function(t){if(void 0!==Ri)return new Ri(t);if(e.Thread.is_main){let i,r=t.leaflet||window.L,n=r.GridLayer?r.GridLayer:r.TileLayer,s=n===r.GridLayer?"1.x":"0.7.x",o={};return n===r.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){n.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(o,{initialize(e){e.showDebug=!!e.showDebug,r.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=Si.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===Ri.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),n.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var i=t.getCenter();i.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(i),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){n.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,i=document.createElement("div");if(i.setAttribute("data-tile-key",t),i.style.width="256px",i.style.height="256px",this.options.showDebug){var r=document.createElement("div");r.textContent=t,r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.color="white",r.style.fontSize="16px",r.style.textOutline="1px #000000",r.style.padding="8px",i.appendChild(r),i.style.borderStyle="solid",i.style.borderColor="white",i.style.borderWidth="1px"}return i},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),r.Browser.chrome||r.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=r.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),r.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(n=function(e){e._moveEnd(!0),e.fire("viewreset")},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout(function(){o=null,n.apply(e,t)},s)});zi.scrollWheelZoom._performZoom||(zi.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,r=e.getZoom();e._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,r+n>=this._map.getMaxZoom()?n=this._map.getMaxZoom()-r:r+n<=this._map.getMinZoom()&&(n=this._map.getMinZoom()-r),n&&("center"===e.options.scrollWheelZoom?i(t,e.getCenter(),r+n):i(t,this._lastMousePos,r+n),l(e))}else zi.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var n,s,o},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const n=function(t,n,s){e._stop();var o=e._zoom;n=r.latLng(n),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=r.Util.requestAnimFrame(l,e),i(t,n,o+(s-o)*u)):i(t,n,s)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const i=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),zi.doubleClickZoom._onDoubleClick||(zi.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var i=this._map,r=i.getZoom(),s=i.options.zoomDelta,o=e.originalEvent.shiftKey?r-s:r+s;"center"===i.options.doubleClickZoom?n(t,i.getCenter(),o):n(t,i.containerPointToLatLng(e.containerPoint),o)}else zi.doubleClickZoom._onDoubleClick.call(this,e)},i&&e.doubleClickZoom.enable()}e._zoomAnimated&&(zi.map._animateZoom||(zi.map._animateZoom=e._animateZoom),e._animateZoom=function(e,i,s,o){this===t._map?(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=i,n(t,e,i)),setTimeout(r.Util.bind(this._onZoomTransitionEnd,this),250)):zi.map._animateZoom.call(this,e,i,s,o)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);r.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let i=Object.assign({},t,{leaflet_event:e});this._selection_events.click(i)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let i=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(i)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),i=function(e,t,i){var n=e._map,s=e.scene,o=n.getZoomScale(i),a=n.getSize().divideBy(2),l=(t instanceof r.Point?t:n.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=n.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),n._move(u,i,{flyTo:!0})},"function"!=typeof(Ri=n.extend(o)).remove&&(Ri.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),Ri.layerBaseClass=n,Ri.leafletVersion=s,new Ri(t)}}(t)},debug:{log:e.log,yaml:hi,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Si,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Mi});try{i.debug.ESM=!0,i.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=i)}catch(e){}var n=i;export{n as default};
1
+ var e,t,i={};function r(r,n){if(e)if(t){var s="var shared_chunk = {}; ("+e+")(shared_chunk); ("+t+")(shared_chunk);",o={};e(o),(i=n(o)).workerURL=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))}else t=n;else e=n}r(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function r(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==i(t)?t:t+""}function n(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var s,o="v0.22.0",a=s={},l=0,u={};function h(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var i=s.targets;for(let e=0;e<t.length;e++){if(!i[t[e]])return[];i=i[t[e]]}return[e,i]}function c(e,t=null,i=null,r=[]){if(!e)return r;if(Array.isArray(e))e.forEach((t,i)=>c(t,e,i,r));else if("object"==typeof e)if(e instanceof ArrayBuffer)r.push({object:e,parent:t,property:i});else if(e.buffer instanceof ArrayBuffer)r.push({object:e.buffer,parent:t,property:i});else for(let t in e)c(e[t],e,t,r);return r}function d(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}s.targets={},s.addTarget=function(e,t){s.targets[e]=t},s.removeTarget=function(e){e&&delete s.targets[e]},s.withTransferables=function(...e){if(!(this instanceof s.withTransferables))return new s.withTransferables(...e);this.value=e,this.transferables=c(this.value)},t.is_main&&(s.postMessage=function(e,t,...i){if(Array.isArray(e))return Promise.all(e.map(e=>s.postMessage(e,t,...i)));let r={};"object"==typeof t&&(r=t,t=t.method);var n=new Promise((e,r)=>{u[l]={method:t,message:i,resolve:e,reject:r}});let o,a=[];return i&&1===i.length&&i[0]instanceof s.withTransferables&&(a=i[0].transferables,i=i[0].value),o={type:"main_send",message_id:l,method:t,message:i},r.stringify&&(o=JSON.stringify(o)),e.postMessage(o,a.map(e=>e.object)),d(a),a.length>0&&m("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,n},s.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let i="string"==typeof t.data?JSON.parse(t.data):t.data,r=i.message_id;if("worker_reply"===i.type)u[r]&&(i.error?u[r].reject(i.error):u[r].resolve(i.message),delete u[r]);else if("worker_send"===i.type&&null!=r){let t,n,o,a,l;try{if([a,o]=h(i.method),!o)throw Error(`Worker broker could not dispatch message type ${i.method} on target ${i.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${i.method} on target ${i.target} because object has no method with that name`);t=l.apply(o,i.message)}catch(e){n=e}let u,c=[];t instanceof Promise?t.then(t=>{t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t},e.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:r,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof s.withTransferables&&(c=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t,error:n instanceof Error?`${n.message}: ${n.stack}`:n},e.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to worker thread`))}})},s.getMessages=function(){return u},s.getMessageId=function(){return l}),t.is_worker&&(s.postMessage=function(e,...t){let i={};"object"==typeof e&&(i=e,e=e.method);var r=new Promise((i,r)=>{u[l]={method:e,message:t,resolve:i,reject:r}});let n,o=[];return t&&1===t.length&&t[0]instanceof s.withTransferables&&(o=t[0].transferables,t=t[0].value),n={type:"worker_send",message_id:l,method:e,message:t},i.stringify&&(n=JSON.stringify(n)),self.postMessage(n,o.map(e=>e.object)),d(o),o.length>0&&m("trace",`'${e}' transferred ${o.length} objects to main thread`),l++,r},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,i=t.message_id;if("main_reply"===t.type)u[i]&&(t.error?u[i].reject(t.error):u[i].resolve(t.message),delete u[i]);else if("main_send"===t.type&&null!=i){let r,n,o,a,l;try{if([a,o]=h(t.method),!o)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof o[a]&&o[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);r=l.apply(o,t.message)}catch(e){n=e}let u,c=[];r instanceof Promise?r.then(e=>{e instanceof s.withTransferables&&(c=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:i,message:e},self.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:i,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(r instanceof s.withTransferables&&(c=r.transferables,r=r.value[0]),u={type:"worker_reply",message_id:i,message:r,error:n instanceof Error?`${n.message}: ${n.stack}`:n},self.postMessage(u,c.map(e=>e.object)),d(c),c.length>0&&m("trace",`'${a}' transferred ${c.length} objects to main thread`))}}));const f={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},p={};let _={};function m(e,...i){let r="object"==typeof e?e.level:e;if(f[r]<=f[m.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...i);{if("object"==typeof e&&!0===e.once){if(_[JSON.stringify(i)])return Promise.resolve(!1);_[JSON.stringify(i)]=!0}let n=function(e){if(t.is_main)return p[e]=p[e]||(console[e]?console[e]:console.log).bind(console),p[e]}(r);i.length>1?n(`Tangram ${o} [${r}]: ${i[0]}`,...i.slice(1)):n(`Tangram ${o} [${r}]: ${i[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}m.level="info",m.workers=null,m.setLevel=function(e){m.level=e,t.is_main&&Array.isArray(m.workers)&&a.postMessage(m.workers,"_logSetLevelProxy",e)},t.is_main&&(m.setWorkers=function(e){m.workers=e},m.reset=function(){_={}}),a.addTarget("_logProxy",m),a.addTarget("_logSetLevelProxy",m.setLevel);const g={};let y;a.addTarget("Utils",g),g.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},g.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},g._requests={},g._proxy_requests={},g.io=function(e,i=6e4,r="text",n="GET",s={},o=null,l=!1){if(t.is_worker&&g.isMicrosoft())return m("debug","Proxying request for URL to worker",e),o&&(g._proxy_requests[o]=!0),a.postMessage("Utils.io",e,i,r,n,s,o,!0);var u=new XMLHttpRequest,h=new Promise((t,o)=>{if(u.open(n,e,!0),u.timeout=i,u.responseType=r,s&&"object"==typeof s)for(let e in s)u.setRequestHeader(e,s[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):o(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{o(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{o(Error("timeout "+e.toString()))},u.send()});return h=h.then(e=>(o&&delete g._requests[o],l?a.withTransferables(e):e)),o&&(g._requests[o]=u),h},g.cancelRequest=function(e){if(t.is_worker&&g._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);g._requests[e]?(m("trace",`Cancelling network request key '${e}'`),g._requests[e].abort(),delete g._requests[e]):m("trace",`Could not find network request key '${e}'`)},g.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},g.use_high_density_display=!0,g.updateDevicePixelRatio=function(){let e=g.device_pixel_ratio;return g.device_pixel_ratio=g.use_high_density_display&&window.devicePixelRatio||1,g.device_pixel_ratio!==e},t.is_main&&g.updateDevicePixelRatio(),g.isPowerOf2=function(e){return!(e&e-1)},g.interpolate=function(e,t,i){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,n,s,o,a;if(e<=t[0][0])o=t[0][1],"function"==typeof i&&(o=i(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof i&&(o=i(o));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],n=t[l+1][0],Array.isArray(t[l][1])){o=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof i?(a=i(t[l][1][u]),s=i(t[l+1][1][u])-a,o[u]=s*(e-r)/(n-r)+a):(s=t[l+1][1][u]-t[l][1][u],o[u]=s*(e-r)/(n-r)+t[l][1][u])}else"function"==typeof i?(a=i(t[l][1]),o=(s=i(t[l+1][1])-a)*(e-r)/(n-r)+a):o=(s=t[l+1][1]-t[l][1])*(e-r)/(n-r)+t[l][1];break}return o},g.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var b=y={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function v(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let i=e.indexOf("#");return i>-1&&(e=e.substr(0,i)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function A(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}const T={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=T.id++,e.max_time=e.max_time||T.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,i)=>{e.resolve=t,e.reject=i});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<T.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=T.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<T.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function k(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let i=t.indexOf(e);i>-1&&t.splice(i,1)},unsubscribeAll(){t=[]},trigger(e,...i){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...i)}catch(t){m("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let i=!1;return t.forEach(t=>{"function"==typeof t[e]&&(i=!0)}),i}})}function E(e,t){let i={};return t.forEach(t=>i[t]=e[t]),i}class S{constructor(e,t,i={}){i=S.sliceOptions(i),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=i.filtering,this.density=i.density||1,this.sprites=i.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,S.textures[this.name]&&(this.retain_count=S.textures[this.name].retain_count,S.textures[this.name].retain_count=0,S.textures[this.name].destroy()),S.textures[this.name]=this,S.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},i)),this.load(i),m("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?m("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,S.textures[this.name]===this&&(delete S.textures[this.name],delete S.texture_configs[this.name]),this.valid=!1,m("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&m("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(S.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),S.activeUnit=e,S.boundTexture=null),S.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),S.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let i=new Image;i.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=i.width,e.height=i.height,r.drawImage(i,0,0),this.setElement(e,t)}else this.setElement(i,t)}catch(e){this.loaded=!1,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},i.onerror=i=>{this.loaded=!1,m("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,i,t),S.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:i,texture:t}),e(this)},g.isSafari()&&"data:"===this.url.slice(0,5)||(i.crossOrigin="anonymous"),i.src=this.url}),this.loading}setData(e,t,i,r={}){return this.width=e,this.height=t,Array.isArray(i)&&(i=new Uint8Array(i)),this.update(i,r),this.setFiltering(r),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let i=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(i)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",m("warn",`Texture '${this.name}': ${e}`,t),S.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),S.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),g.isPowerOf2(this.width)&&g.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),S.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=S.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}S.create=function(e,t,i){return new S(e,t,i)},S.retain=function(e){S.textures[e]&&S.textures[e].retain()},S.release=function(e){S.textures[e]&&S.textures[e].release()},S.destroy=function(e){Object.keys(S.textures).forEach(t=>{var i=S.textures[t];i.gl===e&&i.destroy({force:!0})})},S.getSpriteInfo=function(e,t){let i=S.textures[e];return i&&{size:i.sizes[t],css_size:i.css_sizes[t],aspect:i.aspects[t],texcoords:i.texcoords[t]}},S.getTexcoordsForSprite=function(e,t,i){var r=i[1]-e[1]-t[1];return[e[0]/i[0],r/i[1],(t[0]+e[0])/i[0],(t[1]+r)/i[1]]},S.createFromObject=function(e,t){let i=[];if(t)for(let r in t){let n=t[r];if(n.skip_create)continue;if(!S.changed(r,n))continue;let s=S.create(e,r,n);i.push(s.loading)}return Promise.all(i)},S.default="__default",S.createDefault=function(e){return S.create(e,S.default)},S.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},S.changed=function(e,t){let i=S.textures[e];if(i){if("element"===i.config_type||null!=t.element)return!0;if(t=S.sliceOptions(t),S.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},S.getInfo=function(e){if(e||(e=Object.keys(S.textures)),Array.isArray(e))return Promise.all(e.map(e=>S.getInfo(e)));var t=S.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},S.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>S.textures[e.name]=e),S.textures))},S.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},S.textures={},S.texture_configs={},S.boundTexture=null,S.activeUnit=null,a.addTarget("Texture",S),k(S);var R={parseUniforms:function(e={}){var t=[];for(const[i,r]of Object.entries(e))if("number"==typeof r)t.push({type:"float",method:"1f",name:i,value:r,path:[i]});else if(Array.isArray(r)){if("number"==typeof r[0])r.length>=2&&r.length<=4?t.push({type:"vec"+r.length,method:r.length+"fv",name:i,value:r,path:[i]}):r.length>4&&t.push({type:"float[]",method:"1fv",name:i+"[0]",value:r,path:[i]});else if("string"==typeof r[0])for(let e=0;e<r.length;e++)t.push({type:"sampler2D",method:"1i",name:i+"["+e+"]",value:r[e],path:[i,e]});else if(Array.isArray(r[0])&&"number"==typeof r[0][0]&&r[0].length>=2&&r[0].length<=4)for(let e=0;e<r.length;e++)t.push({type:"vec"+r[0].length,method:r[0].length+"fv",name:i+"["+e+"]",value:r[e],path:[i,e]})}else"boolean"==typeof r?t.push({type:"bool",method:"1i",name:i,value:r,path:[i]}):"string"==typeof r&&t.push({type:"sampler2D",method:"1i",name:i,value:r,path:[i]});return t},defineVariable:function(e,t){var i,r;if("number"==typeof t)i="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?i="vec"+t.length:(i="float",r=t.length):"string"==typeof t[0]?(i="sampler2D",r=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(i="vec"+t[0].length,r=t.length);else if("boolean"==typeof t)i="bool";else{if("string"!=typeof t)return;i="sampler2D"}var n="";return n+=`${i} ${e}`,r&&(n+=`[${r}]`),n+";\n"},defineUniform:function(e,t){var i=R.defineVariable(e,t);if(i)return"uniform "+i},expandVec3:function(e,t=1){let i;if(Array.isArray(e)){if(2!==e.length)return e;i=[...e,t].map(parseFloat)}else i=[e,e,e].map(parseFloat);if(i&&i.every(e=>"number"==typeof e&&!isNaN(e)))return i},expandVec4:function(e,t=1){let i;if(Array.isArray(e)){if(3!==e.length)return e;i=[...e,t].map(parseFloat)}else i=[e,e,e,t].map(parseFloat);if(i&&i.every(e=>"number"==typeof e&&!isNaN(e)))return i}};let z=[];function M(e,t){let i=z.filter(t=>t[0]===e)[0];return i=i&&i[1],i||(z.push([e,{}]),i=z[z.length-1][1]),i[t]||(i[t]=e.getExtension(t)),i[t]}function P(e){var t,i,r=0;if(0===e.length)return r;for(t=0,i=e.length;t<i;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var N,C,L=(C||(C=1,N=function(e){e=String(e);for(var t,i=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(o=t[1].trim()).split(":"),n=r.slice(2).join(":").trim(),s=parseInt(r[0],10),o=parseInt(r[1],10);i.push({message:n,file:s,line:o})}return i}),N),I=O(L);const F=/^\s*#pragma.*$/gm,D=/\\\s*\n/gm;class U{constructor(e,t,i,r){r=r||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=i,this.id=U.id++,this.name=r.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(U.current!==this&&this.gl.useProgram(this.program),U.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,i=this.buildDefineList(),r=this.buildShaderBlockList();for(var n in r){var s=r[n];if(s&&(!Array.isArray(s)||0!==s.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+n+"\\s*$","m");var o=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=o||null!=a){var l="";s.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=o&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),i["TANGRAM_BLOCK_"+n.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",h=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=h&&h.precision>0?"precision highp float;\n":"precision mediump float;\n",i.TANGRAM_VERTEX_SHADER=!0,i.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+U.buildDefineString(i)+this.computed_vertex_source,i.TANGRAM_VERTEX_SHADER=!1,i.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=U.buildExtensionString(e)+u+U.buildDefineString(i)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(D,""),this.computed_fragment_source=this.computed_fragment_source.replace(D,"");try{this.program=U.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in U.defines)t[e]=U.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in U.blocks)t[e]=[],Array.isArray(U.blocks[e])?t[e].push(...U.blocks[e].map((t,i)=>({key:e,source:t,num:i,scope:"ShaderProgram"}))):t[e]=[{key:e,source:U.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let i=this.block_scopes&&this.block_scopes[e]||[],r=null,n=0;for(let s=0;s<this.blocks[e].length;s++)i[s]!==r&&(r=i[s],n=0),t[e].push({key:e,source:this.blocks[e][s],num:n,scope:r||this.name}),n++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>R.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),R.parseUniforms(e).forEach(({name:e,type:t,value:i,method:r})=>{"sampler2D"===t?this.setTextureUniform(e,i):this.uniform(r,e,i)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var i=S.textures[t];null!=i?(i.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):m("warn",`Cannot find texture '${t}'`)}uniform(e,t,i){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=i,this.updateUniform(r)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,i=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,i);break;case"1f":this.gl.uniform1f(t,i);break;case"2f":this.gl.uniform2f(t,i[0],i[1]);break;case"3f":this.gl.uniform3f(t,i[0],i[1],i[2]);break;case"4f":this.gl.uniform4f(t,i[0],i[1],i[2],i[3]);break;case"1iv":this.gl.uniform1iv(t,i);break;case"3iv":this.gl.uniform3iv(t,i);break;case"1fv":this.gl.uniform1fv(t,i);break;case"2fv":this.gl.uniform2fv(t,i);break;case"3fv":this.gl.uniform3fv(t,i);break;case"4fv":this.gl.uniform4fv(t,i);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,i);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,i)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let i=this.lines(e);if(i)return i[t]}block(e,t){let i,r=this.lines(e);for(let e=0;e<t&&e<r.length;e++){let t=r[e],n=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);n&&n.length>1?i={scope:n[1],name:n[2],num:n[3]}:(n=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),n&&n.length>1&&(i=null)),i&&(i.line=null==i.line?-1:i.line+1,i.source=t)}return i}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let i=M(this.gl,t),r=`TANGRAM_EXTENSION_${t}`;this.defines[r]=null!=i,i?e.push(t):m("debug",`Could not enable extension '${t}'`)}),e}}U.id=0,U.current=null,U.defines={},U.blocks={},U.reset=function(){U.programs_by_source={},U.shaders_by_source={}},U.reset(),U.buildDefineString=function(e){var t="";for(var i in e)null!=e[i]&&!1!==e[i]&&("boolean"==typeof e[i]&&!0===e[i]?t+="#define "+i+"\n":"number"==typeof e[i]&&Math.floor(e[i])===e[i]?t+="#define "+i+" "+e[i].toFixed(1)+"\n":t+="#define "+i+" "+e[i]+"\n");return t},U.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},U.addBlock=function(e,...t){U.blocks[e]=U.blocks[e]||[],U.blocks[e].push(...t)},U.removeBlock=function(e){U.blocks[e]=[]},U.replaceBlock=function(e,...t){U.removeBlock(e),U.addBlock(e,...t)},U.updateProgram=function(e,t,i,r){let n=P(e._tangram_id+"::"+i+"::"+r);if(U.programs_by_source[n])return m("trace","Reusing identical source GL program object"),U.programs_by_source[n];var s=U.createShader(e,i,e.VERTEX_SHADER),o=U.createShader(e,r,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==s||null==o)return t;if(e.attachShader(t,s),e.attachShader(t,o),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let n=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${i}\n --- Fragment Shader ---\n ${r}`);throw Object.assign(new Error(n),{type:"program"})}return U.programs_by_source[n]=t,t},U.createShader=function(e,t,i){let r=P(e._tangram_id+"::"+t);if(U.shaders_by_source[r])return m("trace","Reusing identical source GL shader object"),U.shaders_by_source[r];let n=e.createShader(i);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let t=i===e.VERTEX_SHADER?"vertex":"fragment",r=e.getShaderInfoLog(n),s=I(r);throw Object.assign(new Error(r),{type:t,errors:s})}return U.shaders_by_source[r]=n,n};var j,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=M(e,"OES_vertex_array_object")),null!=t?m("info","Vertex Array Object extension available"):!0!==this.disabled?m("warn","Vertex Array Object extension NOT available"):m("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return M(e,t)},create(e,t,i){let r={};r.setup=t,r.teardown=i;let n=this.getExtension(e,"OES_vertex_array_object");return null!=n&&(r._vao=n.createVertexArrayOES(),n.bindVertexArrayOES(r._vao)),r.setup(),r},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let i=this.bound_vao,r=i.filter(t=>t[0]===e)[0];null==r?i.push([e,t]):r[1]=t},bind(e,t){let i=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=i&&null!=t._vao?(i.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=i?i.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let i=this.getExtension(e,"OES_vertex_array_object");null!=i&&null!=t&&null!=t._vao&&(i.deleteVertexArrayOES(t._vao),t._vao=null)}};function G(e,...t){for(let i=0;i<t.length;i++){let r=t[i];if(r)for(let t in r){let i=r[t];null===i||"object"!=typeof i||Array.isArray(i)?void 0!==i&&(e[t]=i):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=G({},i):e[t]=G(e[t],i)}}return e}var V=j={};j.default_source_max_zoom=18,j.default_view_max_zoom=20,j.max_style_zoom=25,j.tile_size=256,j.half_circumference_meters=20037508.342789244,j.circumference_meters=2*j.half_circumference_meters,j.min_zoom_meters_per_pixel=j.circumference_meters/j.tile_size;let $=[];j.metersPerPixel=function(e){return $[e]=$[e]||j.min_zoom_meters_per_pixel/Math.pow(2,e),$[e]};let q=[];j.metersPerTile=function(e){return q[e]=q[e]||j.circumference_meters/Math.pow(2,e),q[e]},j.tile_scale=4096,j.units_per_pixel=j.tile_scale/j.tile_size,j.height_scale=16;let W=[];j.unitsPerMeter=function(e){return W[e]=W[e]||j.tile_scale/(j.tile_size*j.metersPerPixel(e)),W[e]},j.metersForTile=function(e){return{x:e.x*j.circumference_meters/Math.pow(2,e.z)-j.half_circumference_meters,y:-(e.y*j.circumference_meters/Math.pow(2,e.z)-j.half_circumference_meters)}},j.tileForMeters=function([e,t],i){return{x:Math.floor((e+j.half_circumference_meters)/(j.circumference_meters/Math.pow(2,i))),y:Math.floor((-t+j.half_circumference_meters)/(j.circumference_meters/Math.pow(2,i))),z:i}},j.wrapTile=function({x:e,y:t,z:i},r={x:!0,y:!1}){var n=(1<<i)-1;return r.x&&(e&=n),r.y&&(t&=n),{x:e,y:t,z:i}},j.metersToLatLng=function(e){return e[0]/=j.half_circumference_meters,e[1]/=j.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},j.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=j.half_circumference_meters,e[0]*=j.half_circumference_meters/180,e},j.tileSpaceToLatlng=function(e,t,i){const r=j.unitsPerMeter(t);return j.transformGeometry(e,e=>{e[0]=e[0]/r+i.x,e[1]=e[1]/r+i.y,j.metersToLatLng(e)}),e},j.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},j.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},j.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},j.findBoundingBox=function(e){for(var t=1/0,i=-1/0,r=1/0,n=-1/0,s=e[0].length,o=0;o<s;o++){var a=e[0][o];a[0]<t&&(t=a[0]),a[1]<r&&(r=a[1]),a[0]>i&&(i=a[0]),a[1]>n&&(n=a[1])}return[t,r,i,n]},j.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},j.centroid=function(e,t=!0){if(!e||0===e.length)return;let i,r=0,n=0,s=0,o=e[0],a=o.length;t&&(i=o[0],o=o.map(e=>[e[0]-i[0],e[1]-i[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let i=o[e],a=o[t],l=i[1]*a[0]-a[1]*i[0];r+=(i[0]+a[0])*l,n+=(i[1]+a[1])*l,s+=3*l}if(!s)return;let l=[r/s,n/s];return t&&(l[0]+=i[0],l[1]+=i[1]),l},j.multiCentroid=function(e){let t=0,i=null;for(let r=0;r<e.length;r++){let n=j.centroid(e[r]);n&&(i=i||[0,0],i[0]+=n[0],i[1]+=n[1],t++)}return t>0&&(i[0]/=t,i[1]/=t),i},j.signedPolygonRingAreaSum=function(e){let t=0,i=e.length;for(let r=0;r<i-1;r++){let i=e[r],n=e[r+1];t+=i[0]*n[1]-n[0]*i[1]}return t+=e[i-1][0]*e[0][1]-e[0][0]*e[i-1][1],t},j.polygonRingArea=function(e){return Math.abs(j.signedPolygonRingAreaSum(e))/2},j.polygonArea=function(e){if(e)return j.polygonRingArea(e[0])},j.multiPolygonArea=function(e){let t=0;for(let i=0;i<e.length;i++)t+=j.polygonArea(e[i]);return t},j.ringWinding=function(e){let t=j.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const Z={functions:{},num_functions:0,num_cached:0};function H(e,t){if("string"==typeof e)e=X(e,t);else if(null!=e&&"object"==typeof e)for(let i in e)e[i]=H(e[i],t);return e}function X(e,t){let i="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(i&&i.length>2)try{const e=i[2],r="function"==typeof t?t(e):e,n=P(r);if(void 0===Z.functions[n]){let t=i[1].length>0&&i[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],Z.functions[n]=new Function(t.toString(),r),Z.functions[n].source=e,Z.num_functions++}else Z.num_cached++;return Z.functions[n]}catch(t){return e}return e}var Y,J={},K=O(function(){if(Y)return J;Y=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return e<0?0:e>1?1:e}function r(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function n(e){return"%"===e[e.length-1]?i(parseFloat(e)/100):i(parseFloat(e))}function s(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{J.parseCSSColor=function(i){var o,a=i.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var h=a.substr(0,l),c=a.substr(l+1,u-(l+1)).split(","),d=1;switch(h){case"rgba":if(4!==c.length)return null;d=n(c.pop());case"rgb":return 3!==c.length?null:[r(c[0]),r(c[1]),r(c[2]),d];case"hsla":if(4!==c.length)return null;d=n(c.pop());case"hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,p=n(c[1]),_=n(c[2]),m=_<=.5?_*(p+1):_+p-_*p,g=2*_-m;return[t(255*s(g,m,f+1/3)),t(255*s(g,m,f)),t(255*s(g,m,f-1/3)),d];default:return null}}return null}}catch(e){}return J}());const Q={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ie=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),re=e=>Array.isArray(e)?e.map(ie).map(ee):ee(ie(e));Object.assign(Q,{clampPositive:ee,noNaN:te,parseNumber:ie,parsePositiveNumber:re}),Q.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},Q.zeroPair=Object.freeze([0,0]),Q.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},Q.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},Q.getFeatureParseContext=function(e,t,i){return{feature:e,id:e.id,tile:t,global:i,zoom:t.style_z,geometry:V.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ne={STATIC:0,DYNAMIC:1,ZOOM:2};Q.CACHE_TYPE=ne,Q.createPropertyCache=function(e,t=null,i=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let r={value:e,type:ne.STATIC};return Array.isArray(r.value)&&Array.isArray(r.value[0])?(r.zoom={},r.type=ne.ZOOM):"function"==typeof r.value&&(r.type=ne.DYNAMIC,r.dynamic_transform="function"==typeof i?i:null),"function"==typeof t&&(r.zoom?r.value=r.value.map((e,i)=>[e[0],t(e[1],i)]):"function"!=typeof r.value&&(r.value=t(r.value,0))),r},Q.createColorPropertyCache=function(e){return Q.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?X(Q.wrapFunction(Q.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?Q.macros["Style.color.randomColor"]:e)};const se=e=>"string"==typeof e&&"%"===e[e.length-1],oe=e=>"auto"===e,ae=e=>se(e)||oe(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return Q.createPropertyCache(e.value,(i,r)=>(Array.isArray(i)?(i=i.map((t,i)=>e.has_ratio[r][i]?t:re(t)).map((i,n)=>e.has_pct[r][n]?t.css_size[n]*i/100:i),e.has_ratio[r][0]?i[0]=i[1]*t.aspect:e.has_ratio[r][1]&&(i[1]=i[0]/t.aspect)):(i=re(i),i=e.has_pct[r]?t.css_size.map(e=>e*i/100):[i,i]),i))}function he(e,t){try{return e(t)}catch(i){m("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${i.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}Q.createPointSizePropertyCache=function(e,t){let i=null,r=null;if(se(e))i=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):se(e[1]))&&(i=e.map(e=>Array.isArray(e[1])?e[1].map(e=>se(e)):se(e[1])),r=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>oe(e))),r.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(i=[e.map(se)],r=[e.map(oe)],r[0].every(e=>e)))throw le}else if(oe(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(i||r){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=i,e.has_ratio=r,e.sprites={}}else e=Q.createPropertyCache(e,re);return e},Q.evalCachedPointSizeProperty=function(e,t,i,r){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),Q.evalCachedProperty(e.sprites[t.sprite],r)):(e.texture=e.texture||ue(e,i),Q.evalCachedProperty(e.texture,r)):Q.evalCachedProperty(e,r)},Q.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?he(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,he(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},Q.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*V.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ie(e),e*=V.metersPerPixel(t.zoom)):e=ie(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],Q.convertUnits(e[1],t)]):e.map(e=>Q.convertUnits(e,t));return e},Q.parseUnits=function(e){var t={value:ie(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},Q.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?he(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,he(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=g.interpolate(t.zoom,e.value,e=>Q.convertUnits(e,t)),e.zoom[t.zoom]):Q.convertUnits(e.value,t)},Q.string_colors={},Q.colorForString=function(e){if(Q.string_colors[e])return Q.string_colors[e];let t=K.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=Q.defaults.color,Q.string_colors[e]=t,t},Q.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let i=he(e.dynamic,t);return"string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let i=he(e.dynamic,t);return"string"==typeof i&&(i=Q.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if("string"==typeof e.value)return e.static=Q.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let i=e.value[t];i&&"string"==typeof i[1]&&(i[1]=Q.colorForString(i[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=g.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},Q.evalCachedColorPropertyWithAlpha=function(e,t,i){const r=Q.evalCachedColorProperty(e,i);if(null!=r&&null!=t){const e=Q.evalCachedProperty(t,i);if(null!=e)return[r[0],r[1],r[2],e]}return r},Q.parseColor=function(e,t={}){if("function"==typeof e&&(e=he(e,t)),"string"==typeof e)e=Q.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i[1]&&(i[1]=Q.colorForString(i[1]))}t.zoom&&(e=g.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},Q.calculateOrder=function(e,t){return"function"==typeof e?e=he(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:re(e)),e},Q.evalProperty=function(e,t){return"function"==typeof e?he(e,t):e};class ce{constructor(e,t,i){this.gl=e,this.workers=t,this._lock_fn="function"==typeof i&&i,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=S.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...ce.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((i,r)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:i,reject:r}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var i=this.requests[t];if(i.sent)continue;let r,n,s=255,{point:o,radius:l}=i;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);n={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},n={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<n.x*n.y*4)&&(this.pixels=new Uint8Array(n.x*n.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((o.x-l.x)*this.fbo_size.width),Math.round((1-o.y-l.y)*this.fbo_size.height),n.x,n.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(n.y/2)*n.x+Math.round(n.x/2)),h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(h>0)r=h+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<n.y;t++)for(let i=0;i<n.x;i++,u+=4)if(h=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),h>0){let o=(i-n.x/2)*(i-n.x/2)+(t-n.y/2)*(t-n.y/2);o<=e&&(r=h+(this.pixels[u+3]<<24)>>>0,s=this.pixels[u+3],e=o)}}255!==s?null!=this.workers[s]&&a.postMessage(this.workers[s],"self.getFeatureSelection",{id:i.id,key:r}).then(e=>{this.finishRead(e)}):this.finishRead({id:i.id}),i.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var i=e.feature,r=!1;(null!=i&&null==this.feature||null==i&&null!=this.feature||null!=i&&null!=this.feature&&JSON.stringify(i)!==JSON.stringify(this.feature))&&(r=!0),this.feature=i,t.resolve({feature:i,changed:r,request:t}),delete this.requests[e.id]}else m("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,i=this.map_entry>>8&255,r=this.map_entry>>16&255,n=this.map_prefix,s=t/255,o=i/255,a=r/255,l=n/255,u=t+(i<<8)+(r<<16)+(n<<24)>>>0;return this.map[u]={color:[s,o,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,i){var r=this.makeEntry(t);return r.feature={id:e.id,properties:e.properties,source_name:i.source,source_layer:i.layer,layers:i.layers,tile:this.tiles[t.key].tile},r.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var de;ce.map={},ce.tiles={},ce.map_size=0,ce.map_entry=0,ce.map_prefix=0,ce.defaultColor=[0,0,0,1];var fe=de={};de.BYTE=5120,de.UNSIGNED_BYTE=5121,de.SHORT=5122,de.UNSIGNED_SHORT=5123,de.INT=5124,de.UNSIGNED_INT=5125,de.FLOAT=5126;class pe{constructor(e,t,i,r,n){n=n||{},this.gl=e,this.vertex_data=t,this.element_data=i,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=n.draw_mode||this.gl.TRIANGLES,this.data_usage=n.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=n.uniforms,this.textures=n.textures,this.retain=n.retain||!1,this.created_at=+new Date,this.fade_in_time=n.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||U.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let i=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",i),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),i<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>S.release(e)),!0}}const _e=["emission","ambient","diffuse","specular"];class me{constructor(e){e=e||{},_e.forEach(t=>{const i=e[t];null!=i&&(i.texture?this[t]={texture:i.texture,mapping:i.mapping||"spheremap",scale:R.expandVec3(null!=i.scale?i.scale:1),amount:R.expandVec4(null!=i.amount?i.amount:1)}:"number"==typeof i||Array.isArray(i)?this[t]={amount:R.expandVec4(i)}:this[t]="string"==typeof i?{amount:Q.parseColor(i)}:i)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:R.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){_e.forEach(t=>{let i=`TANGRAM_MATERIAL_${t.toUpperCase()}`,r=i+"_TEXTURE";e.defines[i]=null!=this[t],this[t]&&this[t].texture&&(e.defines[r]=!0,e.defines[r+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(me.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){_e.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ge;me.block="material";var ye=ge={};ge.copy=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=e[r];return t},ge.neg=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=-e[r];return t},ge.add=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]+t[n];return i},ge.sub=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]-t[n];return i},ge.signed_area=function(e,t,i){return(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])},ge.mult=function(e,t){var i,r=[],n=e.length;if("number"==typeof t)for(i=0;i<n;i++)r[i]=e[i]*t;else for(n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]*t[i];return r},ge.div=function(e,t){var i,r=[];if("number"==typeof t)for(i=0;i<e.length;i++)r[i]=e[i]/t;else{var n=Math.min(e.length,t.length);for(i=0;i<n;i++)r[i]=e[i]/t[i]}return r},ge.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ge.rot=function(e,t){var i=Math.cos(t),r=Math.sin(t);return[e[0]*i-e[1]*r,e[0]*r+e[1]*i]},ge.angle=function([e,t]){return Math.atan2(t,e)},ge.angleBetween=function(e,t){var i=ge.dot(ge.normalize(ge.copy(e)),ge.normalize(ge.copy(t)));return i>1&&(i=1),Math.acos(i)},ge.isEqual=function(e,t){for(var i=e.length,r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0},ge.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ge.length=function(e){return Math.sqrt(ge.lengthSq(e))},ge.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ge.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ge.dot=function(e,t){for(var i=0,r=Math.min(e.length,t.length),n=0;n<r;n++)i+=e[n]*t[n];return i};class be{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=R.expandVec3(t.ambient||0):this.ambient=Q.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=R.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Q.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=R.expandVec3(t.specular||0):this.specular=Q.parseColor(t.specular).slice(0,3)}static create(e,t){if(be.types[t.type])return new be.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=be.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(U.removeBlock(be.block),!be.enabled)return;let t="";if(e&&Object.keys(e).length>0){let i={};for(let t in e)i[e[t].type]=!0;for(let e in i)be.types[e].inject();for(let i in e)e[i].inject(),t+=`calculateLight(${i}, _eyeToPoint, _normal);\n`}let i=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;U.addBlock(be.block,i)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;U.addBlock(be.block,e),U.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}be.types={},be.block="lighting",be.enabled=!0,be.types.ambient=class extends be{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},be.types.directional=class extends be{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,i=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*i,Math.sin(Math.PI*e/180)*i,-.5],null==t.ambient&&(this.ambient=R.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class ve extends be{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,U.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],U.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=V.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=Q.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=Q.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,Q.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)})),U.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,Q.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:V.metersPerPixel(this.view.zoom)}))}}be.types.point=ve,be.types.spotlight=class extends ve{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=ye.normalize(ye.copy(e))}static inject(){U.addBlock(be.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(m({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const i=we.types[e.type](e);if(i)return new i(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const i=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],r=E(e.config,i),n=E(t.config,i);return JSON.stringify(r)!==JSON.stringify(n)}static projectData(e){var t=+new Date;for(var i in e.layers)for(var r=e.layers[i].features.length,n=0;n<r;n++){var s=e.layers[i].features[n];V.transformGeometry(s.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){V.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:i}){let r=V.unitsPerMeter(t);for(var n in e.layers)for(var s=e.layers[n].features.length,o=0;o<s;o++){var a=e.layers[n].features[o];V.transformGeometry(a.geometry,e=>{e[0]=(e[0]-i.x)*r,e[1]=(e[1]-i.y)*r*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let i=e.source_data.layers[t];i&&i.features&&i.features.forEach(e=>{V.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-V.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-V.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return m("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:V.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!g.isPowerOf2(this.tile_size))&&(m({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=V.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=V.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const i=this.rasters[t];if(this.sources[i]&&this.sources[i]!==this&&!this.sources[i].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ae=0;class Te extends we{constructor(e,t){super(e,t),this.response_type="";let[i,r]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var i=e.indexOf("?"),r=e.indexOf("#"),n="";r>-1&&(n=e.slice(r),e=e.slice(0,r)),-1===i&&(i=e.length,e+="?"),i++;var s="",o=[];for(var a in t)""===A(a,e)?s+=`${a}=${t[a]}&`:o.push([a,t[a]]);return[e=e.slice(0,i)+s+e.slice(i)+n,o]}(e.url,e.url_params);this.url=i,r.forEach(([t,i])=>{m({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${i}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),i=e.source_data;return i.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(r=>{let n=Ae+++"-"+t,s=g.io(t,6e4,this.response_type,"GET",this.request_headers,n);i.request_id=n,i.error=null,s.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,i,t):i.layers={},e.debug.parsing=+new Date-e.debug.parsing,r(e)})}).catch(t=>{i.error=t.stack,r(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class ke extends Te{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):m({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,i,r,n]=e.bounds;return{latlng:[...e.bounds],meters:{min:V.latLngToMeters([t,n]),max:V.latLngToMeters([r,i])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=V.wrapTile(e);let i=t.tiles.min[e.z];i||(i=t.tiles.min[e.z]=V.tileForMeters(t.meters.min,e.z));let r=t.tiles.max[e.z];if(r||(r=t.tiles.max[e.z]=V.tileForMeters(t.meters.max,e.z)),e.y<i.y||e.y>r.y)return!1;if(i.x<=r.x){if(e.x<i.x||e.x>r.x)return!1}else if(e.x>r.x&&e.x<i.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let i=V.wrapTile(t.coords,{x:!0});this.tms&&(i.y=Math.pow(2,i.z)-1-i.y);let r=e.replace("{x}",i.x).replace("{y}",i.y).replace("{z}",i.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(i));return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}getDensityModifier(){if(this.url_density_scales){const e=g.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:i}){let r="";for(let n=i;n>0;n--){let i=0,s=1<<n-1;e&s&&i++,t&s&&(i+=2),r+=i.toString()}return r}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const Ee={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:i})=>e+"/"+t+"/"+i,key(e,t,i){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,i].join("/")},normalizedKey(e,t,i){return this.key(this.normalizedCoord(e,t),t,i)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:i},r){if(i!==(r=Math.max(0,r))){let n=Math.pow(2,i-r);e=Math.floor(e/n),t=Math.floor(t/n),i=r}return this.coord({x:e,y:t,z:i})},coordForTileZooms({x:e,y:t,z:i},r){const n=this.findZoomInRange(i,r);return n!==i?this.coordAtZoom({x:e,y:t,z:i},n):this.coord({x:e,y:t,z:i})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:i,y:r}=this.coordAtZoom(t,e.z);return e.x===i&&e.y===r}return!1},parent({coords:e,source:t,style_z:i}){if(i>0){i--;const r=Math.max(i-t.zoom_bias,t.zooms[0]),n=this.coordForTileZooms(this.coordAtZoom(e,r),t.zooms);return n.z>i?null:{key:this.key(n,t,i),coords:n,style_z:i,source:t}}},children({coords:e,source:t,style_z:i},r={}){i++;const n=this.coordForTileZooms(this.coordAtZoom(e,i-t.zoom_bias),t.zooms);if(n.z===e.z)return[{key:this.key(n,t,i),coords:n,style_z:i,source:t}];{const s=this.key(n,t,i);if(r[t.id]=r[t.id]||{},null==r[t.id][s]){const o=Math.pow(2,n.z-e.z),a=e.x*o,l=e.y*o;let u=[];for(let e=a;e<a+o;e++)for(let r=l;r<l+o;r++){let s=this.coord({x:e,y:r,z:n.z});u.push({key:this.key(s,t,i),coords:s,style_z:i,source:t})}r[t.id][s]=u}return r[t.id][s]}}};class Se extends ke{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=V.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),i=t.key;if(!this.textures[i]){let e=this.formatURL(this.url,{coords:t});this.textures[i]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[i]}adjustRasterTileZoom(e){let t=e.coords;const i=this.sources[e.source];if(i!==this){let r=this.zoom_bias-i.zoom_bias;r>0?t=Ee.normalizedCoord(e.coords,{zoom_bias:r,zooms:this.zooms}):(r<0&&m({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${i.name}' it's attached to. Downsampling this source ${-r} extra zoom levels to match.`),t=Ee.coordForTileZooms(t,this.zooms))}return t}}class Re extends Se{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:i}){let r=this.adjustRasterTileZoom(e);const n="opaque"!==t,s=`raster-${this.name}-${r.key}-${n?"alpha":"opaque"}-${i}`;if(S.textures[s])return{name:s,coords:r,skip_create:!0};let o=g.device_pixel_ratio;this.max_display_density&&(o=Math.min(o,this.max_display_density)),o*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*o,a.height=this.tile_size*o,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const i=n?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,i,e,o,l)})),{name:s,element:a,filtering:this.filtering,coords:r}}async drawImage(e,t,i,r,n,s){const o=P(e);this.load_image[o]=this.load_image[o]||this.loadImage(e);const a=await this.load_image[o],l=V.metersPerPixel(r.coords.z)/n/(this.tile_size/V.tile_size),u=(t.meters.min[0]-r.min.x)/l,h=-(t.meters.min[1]-r.min.y)/l,c=(t.meters.max[0]-t.meters.min[0])/l,d=-(t.meters.max[1]-t.meters.min[1])/l;s.globalAlpha=null!=i?i:1,s.drawImage(a,u,h,c,d)}loadImage(e){return new Promise(t=>{let i=new Image;i.onload=()=>t(i),i.onerror=i=>{m("warn",`Raster source '${this.name}': failed to load url: '${e}'`,i),t(null)},g.isSafari()&&"data:"===e.slice(0,5)||(i.crossOrigin="anonymous"),i.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let i="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(i+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(i);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(i)}}}function ze(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Me(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ze(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}we.register("Raster",e=>Se.urlHasTilePattern(e.url)?Se:Re);var Pe={init({generation:e,styles:t,sources:i={},introspection:r}={}){this.setGeneration(e),this.styles=t,this.sources=i,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=r||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof me||(me.isValid(this.material)||(this.material=Q.defaults.material),this.material=new me(this.material)),this.material.inject(this),be.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let i=t.meshes[e];0!==i.vertex_data.vertex_count?(i.vertex_data.end(),i.vertex_elements=i.vertex_data.element_buffer,i.vertex_data=i.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const i=this.tile_data[e.id].meshes;if(null==i[t.key]){const e=this.vertexLayoutForMeshVariant(t);i[t.key]={variant:t,vertex_data:e.createVertexData()}}return i[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;this.tile_data[r.id]||this.startData(r);let n=this.parseFeature(e,t,i);n&&this.buildGeometry(e.geometry,n,i)>0&&(e.generation=this.generation)},buildGeometry(e,t,i){let r;if("Polygon"===e.type?r=this.buildPolygons([e.coordinates],t,i):"MultiPolygon"===e.type?r=this.buildPolygons(e.coordinates,t,i):"LineString"===e.type?r=this.buildLines([e.coordinates],t,i):"MultiLineString"===e.type?r=this.buildLines(e.coordinates,t,i):"Point"===e.type?r=this.buildPoints([e.coordinates],t,i):"MultiPoint"===e.type&&(r=this.buildPoints(e.coordinates,t,i)),r>0&&b.layer_stats){let e=i.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,n=e.debug.layers.tree,s={};i.layers.forEach(e=>{Oe(t,e,1,r,{[this.name]:r},{[this.baseStyle()]:r});let i=n,o=s,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];i[t]=i[t]||{features:0,geoms:0,styles:{},base:{}},null==o[t]&&(o[t]={},Oe(i,t,1,r,{[this.name]:r},{[this.baseStyle()]:r})),e<a.length-1&&(i[t].layers=i[t].layers||{}),i=i[t].layers,o=o[t]}})}return r},parseFeature(e,t,i){try{var r=this.feature_style;if(r.order=this.parseOrder(t.order,i),null==r.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void m({level:"warn",once:!0},e)}if(!(r=this._parseFeature(e,t,i)))return;if(this.shaders.attributes){r.attributes=r.attributes||{};for(const e in this.shaders.attributes)r.attributes[e]=Q.evalCachedProperty(t.attributes&&t.attributes[e],i),"number"!=typeof r.attributes[e]&&(r.attributes[e]=0)}return this.selection?r.interactive=Q.evalProperty(t.interactive,i):r.interactive=!1,!0===r.interactive?r.selection_color=ce.makeColor(e,i.tile,i):r.selection_color=ce.defaultColor,r}catch(t){m("error","Style.parseFeature: style parsing error",e,r,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let i=this.draw[t];"object"!=typeof i||Array.isArray(i)?null==e[t]&&(e[t]=i):e[t]=G({},i,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=Q.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?Q.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?Q.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Q.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=S.getMaxTextureSize(this.gl)},makeMesh(e,t,i={}){let r=this.vertexLayoutForMeshVariant(i.variant);return b.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let i=0;i<e.length;i+=3)t.set([e[i],e[i+1],e[i+1],e[i+2],e[i+2],e[i]],2*i);return t}(t),new pe(this.gl,e,t,r,Me(Me({},i),{},{draw_mode:this.gl.LINES}))):new pe(this.gl,e,t,r,i)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){m("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw m("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var i=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,n=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in n)null==n[e]&&m({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new U(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:n,blocks:i,block_scopes:r,extensions:s}),this.selection?this.selection_program=new U(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:n,blocks:i,block_scopes:r,extensions:s}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,i=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(i)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,i=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,i)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof Se).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let i;try{i=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!i||i.length<1)return t;if(i.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const r=t.uniforms.u_rasters=[],n=t.uniforms.u_raster_sizes=[],s=t.uniforms.u_raster_offsets=[];return i.forEach(i=>{const o=i.index;if(r[o]=i.name,t.textures.push(i.name),n[o]=[i.width,i.height],e.coords.z>i.coords.z){let t=e.coords.z-i.coords.z,r=Math.pow(2,t);s[o]=[(e.coords.x%r+r)%r/r,(r-1-e.coords.y%r)/r,1/r]}else s[o]=[0,0,1]}),t},async loadTextures(e){let t={},i={},r=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((n,s)=>{n instanceof Se&&r.push(n.tileTexture(e,this).then(e=>{t[e.name]=e,i[e.name]=s}))}),await Promise.all(r),await S.createFromObject(this.gl,t);let n=await Promise.all(Object.keys(t).map(e=>S.textures[e]&&S.textures[e].load()).filter(e=>e));return n.forEach(e=>e.retain()),n.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:i[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,i]of Object.entries(this.shaders.attributes))"float"===i.type&&e.push({name:`a_${t}`,size:1,type:fe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let i in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[i]?e.attributes[i]:0},setup(){this.setUniforms(),this.material.setupProgram(U.current)},setUniforms(){var e,t=U.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Oe(e,t,i,r,n,s){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=i,e[t].geoms+=r;for(let i in n)e[t].styles[i]=e[t].styles[i]||0,e[t].styles[i]+=n[i];for(let i in s)e[t].base[i]=e[t].base[i]||0,e[t].base[i]+=s[i]}let Ne=Math.pow(2,16)-1,Ce=!1;class Le{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!Ce||e>Ne&&(this.has_overflown=!0,!Ce)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&Ce?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}Le.setElementIndexUint=function(e){Ce=e};let Ie={[fe.FLOAT]:Float32Array,[fe.BYTE]:Int8Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.INT]:Int32Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.SHORT]:Int16Array,[fe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new Le,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),m("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[fe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=Ie[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),m("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class De{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,i=0;for(let e=0;e<this.attribs.length;e++){let r=this.attribs[e];if(null==r.static){r.offset=this.stride,r.byte_size=r.size;let e=0;switch(r.type){case fe.FLOAT:case fe.INT:case fe.UNSIGNED_INT:r.byte_size*=4,e=2;break;case fe.SHORT:case fe.UNSIGNED_SHORT:r.byte_size*=2,e=1}3&r.byte_size&&(r.byte_size+=4-(3&r.byte_size)),this.stride+=r.byte_size;let n=r.offset>>e;for(let t=0;t<r.size;t++)this.components.push({type:r.type,shift:e,offset:n++,index:i++});this.index[r.name]=t,t+=r.size,this.offset[r.name]=r.offset}else r.static=Array.isArray(r.static)?r.static:[r.static],r.method=`vertexAttrib${r.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in De.enabled_attribs)e.disableVertexAttribArray(t);De.enabled_attribs={},this.dynamic_attribs.forEach(i=>{const r=t.attribute(i.name).location;-1!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,this.stride,i.offset),De.enabled_attribs[r]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(i=>{const r=t.attribute(i.name).location;-1!==r&&e[i.method]instanceof Function&&(e.enableVertexAttribArray(r),e[i.method](r,i.static),e.disableVertexAttribArray(r))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=P(JSON.stringify(this.attribs));if(null==De.add_vertex_funcs[e]){let t,i=["var t, o;"],r=[...this.components];r.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<r.length;e++){let n=r[e];t!==n.type&&(i.push(`t = vs[${n.type}];`),i.push(`o = off${n.shift?" >> "+n.shift:""};`),t=n.type),i.push(`t[o + ${n.offset}] = v[${n.index}];`)}i=i.join("\n");let n=new Function("v","vs","off",i);De.add_vertex_funcs[e]=n}this.addVertex=De.add_vertex_funcs[e]}}De.enabled_attribs={},De.add_vertex_funcs={};const Ue=[{x:0,y:0},{x:V.tile_scale,y:-V.tile_scale}],je=[0,0,1,1];function Be(e,t,i){let r=Ue[0],n=Ue[1];return e[0]<=r.x+i&&t[0]<=r.x+i||e[0]>=n.x-i&&t[0]>=n.x-i||e[1]>=r.y-i&&t[1]>=r.y-i||e[1]<=n.y+i&&t[1]<=n.y+i}function Ge(e,t){t=t||0;let i=Ue[0],r=Ue[1];return e[0]<=i.x+t||e[0]>=r.x-t||e[1]>=i.y-t||e[1]<=r.y+t}var Ve,$e={exports:{}},qe=function(){if(Ve)return $e.exports;function e(e,n,s){s=s||2;var o,a,h,c,f,p,_,m=n&&n.length,g=m?n[0]*s:e.length,y=t(e,0,g,s,!0),b=[];if(!y||y.next===y.prev)return b;if(m&&(y=function(e,r,n,s){var o,a,h,c=[];for(o=0,a=r.length;o<a;o++)(h=t(e,r[o]*s,o<a-1?r[o+1]*s:e.length,s,!1))===h.next&&(h.steiner=!0),c.push(d(h));for(c.sort(l),o=0;o<c.length;o++)u(c[o],n),n=i(n,n.next);return n}(e,n,y,s)),e.length>80*s){o=h=e[0],a=c=e[1];for(var v=s;v<g;v+=s)(f=e[v])<o&&(o=f),(p=e[v+1])<a&&(a=p),f>h&&(h=f),p>c&&(c=p);_=0!==(_=Math.max(h-o,c-a))?1/_:0}return r(y,b,s,o,a,_),b}function t(e,t,i,r,n){var s,o;if(n===k(e,t,i,r)>0)for(s=t;s<i;s+=r)o=w(s,e[s],e[s+1],o);else for(s=i-r;s>=t;s-=r)o=w(s,e[s],e[s+1],o);return o&&m(o,o.next)&&(A(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!m(r,r.next)&&0!==_(r.prev,r,r.next))r=r.next;else{if(A(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function r(e,t,l,u,h,d,f){if(e){!f&&d&&function(e,t,i,r){var n=e;do{null===n.z&&(n.z=c(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,s,o,a,l,u=1;do{for(i=e,e=null,s=null,o=0;i;){for(o++,r=i,a=0,t=0;t<u&&(a++,r=r.nextZ);t++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=r}s.nextZ=null,u*=2}while(o>1)}(n)}(e,u,h,d);for(var p,_,m=e;e.prev!==e.next;)if(p=e.prev,_=e.next,d?s(e,u,h,d):n(e))t.push(p.i/l),t.push(e.i/l),t.push(_.i/l),A(e),e=_.next,m=_.next;else if((e=_)===m){f?1===f?r(e=o(i(e),t,l),t,l,u,h,d,2):2===f&&a(e,t,l,u,h,d):r(i(e),t,l,u,h,d,1);break}}}function n(e){var t=e.prev,i=e,r=e.next;if(_(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(f(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&_(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function s(e,t,i,r){var n=e.prev,s=e,o=e.next;if(_(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,u=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,d=c(a,l,t,i,r),p=c(u,h,t,i,r),m=e.prevZ,g=e.nextZ;m&&m.z>=d&&g&&g.z<=p;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&_(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&_(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=d;){if(m!==e.prev&&m!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&_(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=p;){if(g!==e.prev&&g!==e.next&&f(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&_(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function o(e,t,r){var n=e;do{var s=n.prev,o=n.next.next;!m(s,o)&&g(s,n,n.next,o)&&v(s,o)&&v(o,s)&&(t.push(s.i/r),t.push(n.i/r),t.push(o.i/r),A(n),A(n.next),n=e=o),n=n.next}while(n!==e);return i(n)}function a(e,t,n,s,o,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&p(l,u)){var h=x(l,u);return l=i(l,l.next),h=i(h,h.next),r(l,t,n,s,o,a),void r(h,t,n,s,o,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var i,r=t,n=e.x,s=e.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i;var l,u=i,c=i.x,d=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&f(s<d?n:o,s,c,d,s<d?o:n,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(n-r.x),v(r,e)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&h(i,r)))&&(i=r,p=l)),r=r.next}while(r!==u);return i}(e,t),t){var r=x(t,e);i(t,t.next),i(r,r.next)}}function h(e,t){return _(e.prev,e,t.prev)<0&&_(t.next,e,e.next)<0}function c(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function f(e,t,i,r,n,s,o,a){return(n-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&g(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(v(e,t)&&v(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(_(e.prev,e,t.prev)||_(e,t.prev,t))||m(e,t)&&_(e.prev,e,e.next)>0&&_(t.prev,t,t.next)>0)}function _(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,i,r){var n=b(_(e,t,i)),s=b(_(e,t,r)),o=b(_(i,r,e)),a=b(_(i,r,t));return n!==s&&o!==a||!(0!==n||!y(e,i,t))||!(0!==s||!y(e,r,t))||!(0!==o||!y(i,e,r))||!(0!==a||!y(i,t,r))}function y(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function b(e){return e>0?1:e<0?-1:0}function v(e,t){return _(e.prev,e,e.next)<0?_(e,t,e.next)>=0&&_(e,e.prev,t)>=0:_(e,t,e.prev)<0||_(e,e.next,t)<0}function x(e,t){var i=new T(e.i,e.x,e.y),r=new T(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function w(e,t,i,r){var n=new T(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function A(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function T(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function k(e,t,i,r){for(var n=0,s=t,o=i-r;s<i;s+=r)n+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return n}return Ve=1,$e.exports=e,$e.exports.default=e,e.deviation=function(e,t,i,r){var n=t&&t.length,s=n?t[0]*i:e.length,o=Math.abs(k(e,0,s,i));if(n)for(var a=0,l=t.length;a<l;a++){var u=t[a]*i,h=a<l-1?t[a+1]*i:e.length;o-=Math.abs(k(e,u,h,i))}var c=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,p=r[a+2]*i;c+=Math.abs((e[d]-e[p])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[p+1]-e[d+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var s=0;s<e[n].length;s++)for(var o=0;o<t;o++)i.vertices.push(e[n][s][o]);n>0&&(r+=e[n-1].length,i.holes.push(r))}return i},$e.exports}(),We=O(qe);function Ze(e,t,i=0,r=e.length-1,n=Xe){for(;r>i;){if(r-i>600){const s=r-i+1,o=t-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Ze(e,t,Math.max(i,Math.floor(t-o*l/s+u)),Math.min(r,Math.floor(t+(s-o)*l/s+u)),n)}const s=e[t];let o=i,a=r;for(He(e,i,t),n(e[r],s)>0&&He(e,i,r);o<a;){for(He(e,o,a),o++,a--;n(e[o],s)<0;)o++;for(;n(e[a],s)>0;)a--}0===n(e[i],s)?He(e,i,a):(a++,He(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function He(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Xe(e,t){return e<t?-1:e>t?1:0}const Ye=[0,0,1];function Je(e,t,i,{texcoord_index:r,texcoord_scale:n,texcoord_normalize:s}){let o,a,l,u,h,c,d,f,p,_,m,g,y=t.vertex_elements,b=e.length,v=0;r&&(s=s||1,[o,a,l,u]=n||je);for(let n=0;n<b;n++){const b=500;let w=e[n];w.length>b&&(w=[...w],Ze(w,b,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,b));const A=(x=We.flatten(w),We(x.vertices,x.holes,x.dimensions)),T=A.length,k=t.vertex_count;if(T){r&&([h,c,d,f]=V.findBoundingBox(w),p=d-h,_=f-c,m=(l-o)/p,g=(u-a)/_);for(let e=0;e<w.length;e++){let n=w[e];for(let e=0;e<n.length;e++){let l=n[e];i[0]=l[0],i[1]=l[1],r&&(i[r+0]=((l[0]-h)*m+o)*s,i[r+1]=((l[1]-c)*g+a)*s),t.addVertex(i)}}for(let e=0;e<T;e++)y.push(k+A[e]);v+=T/3}}var x;return v}var Ke='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Qe="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Pe);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:!0,init(){Pe.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,i){var r=this.feature_style;return r.color=this.parseColor(t.color,i),r.color?(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.z*=V.height_scale,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&(!0===r.extrude?(r.height=e.properties.height||Q.defaults.height,r.min_height=e.properties.min_height||Q.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=V.height_scale,r.min_height*=V.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess(e){return e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.z=Q.createPropertyCache(e.z,Q.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,i=null!=e.extrude?1:0,r=this.texcoords?1:0,n=this.getBlendOrderForDraw(e),s=[t,i,r,n].join("/");e.variant=s,null==this.variants[s]&&(this.variants[s]={key:s,blend_order:n,mesh_order:0,selection:t,normal:i,texcoords:r})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_normal",size:3,type:fe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new De(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=127),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildPolygons(e,t,i){let r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=r.vertex_data,s=n.vertex_layout,o=this.makeVertexTemplate(t,r),a={texcoord_index:s.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:V.tile_scale*i.tile.pad_scale*4,winding:i.winding};return t.extrude&&t.height?function(e,t,i,r,n,s,o,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:h,texcoord_scale:c,texcoord_normalize:d,winding:f}){var p=t+(r||0),_=t+i;s[2]=_;var m=Je(e,n,s,{texcoord_index:h,texcoord_scale:c,texcoord_normalize:d}),g=n.vertex_elements,y=n.vertex_count;if(h){d=d||1;var[b,v,x,w]=c||je,A=[[b,w],[b,v],[x,v],[x,w]]}for(var T=e.length,k=0;k<T;k++)for(var E=e[k],S=0;S<E.length;S++)for(var R=E[S],z=0;z<R.length-1;z++){if(l&&Be(R[z],R[z+1],u))continue;let e,t;"CCW"===f?(e=z,t=z+1):(e=z+1,t=z);var M=[[R[t][0],R[t][1],_],[R[t][0],R[t][1],p],[R[e][0],R[e][1],p],[R[e][0],R[e][1],_]];let i=ye.normalize([R[t][0]-R[e][0],R[t][1]-R[e][1],0]),r=ye.cross(Ye,i);s[o+0]=r[0]*a,s[o+1]=r[1]*a,s[o+2]=r[2]*a;for(var P=0;P<M.length;P++)s[0]=M[P][0],s[1]=M[P][1],s[2]=M[P][2],h&&(s[h+0]=A[P][0]*d,s[h+1]=A[P][1]*d),n.addVertex(s);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,m+=2}return m}(e,t.z,t.height,t.min_height,n,o,s.index.a_normal,127,a):Je(e,n,o,a)}});const tt=[0,0],it={butt:0,square:1,round:2},rt={miter:0,bevel:1,round:2},nt=V.tile_scale,st=[0,0],ot=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var i,r,n,s,{join_type:o,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:h,v_scale:c,miter_len_sq:d}=t,f=null!=t.texcoord_index,p=0;if(l&&o===rt.miter){var _=function(e){if(Ge(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ge(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==_){var m=function(e,t){var i=[];for(let n=0;n<e.length;n++){var r=(n+t)%e.length;0!==r&&i.push(e[r])}return i.push(i[0]),i}(e,_);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(m)}}var g=0,y=e.length-1,b=0;for(i=e[g],r=e[g+1];ye.isEqual(i,r);)if(i=r,r=e[1+ ++g],b++,g===e.length-1)return;for(;ye.isEqual(e[y],e[y-1]);)if(b++,0===--y)return;if(!(e.length<2+b))if(s=ye.normalize(ye.perp(i,r)),u&&Be(i,r,h)){var v=ut(e,g,h);v&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(v))}else{l?function(e,t,i,r,n){if(void 0===r||Ge(e))pt(e,i,i,1,0,n,1),pt(e,i,i,0,0,n,-1);else{r===rt.miter?ct(0,e,t,i,n.miter_len_sq,!0,n):dt(r,0,e,t,i,!0,n)}}(i,n=ye.normalize(ye.perp(e[y-1],i)),s,o,t):(Ge(i)||(gt(i,p,s,a,!0,t),f&&a!==it.butt&&(p+=.5*c*t.texcoord_width)),pt(i,s,s,1,p,t,1),pt(i,s,s,0,p,t,-1)),f&&(p+=c*ye.length(ye.sub(r,i)));for(var x=g+1;x<y;x++){var w=x,A=x+1;if(i=e[w],r=e[A],!ye.isEqual(i,r)){if(u&&Be(i,r,h)){pt(i,s,s,1,p,t,1),pt(i,s,s,0,p,t,-1),ft(1,t);var T=ut(e,w+1,h);return void(T&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(T)))}n=s,s=ye.normalize(ye.perp(i,r)),o===rt.miter?ct(p,i,n,s,d,!1,t):dt(o,p,i,n,s,!1,t),f&&(p+=c*ye.length(ye.sub(r,i)))}}i=r,n=s,l?function(e,t,i,r,n,s){if(Ge(e))pt(e,t,t,1,n,s,1),pt(e,t,t,0,n,s,-1),ft(1,s);else{var o=ht(t,i);r===rt.miter&&ye.lengthSq(o)>s.miter_len_sq&&(r=rt.bevel),r===rt.miter?(pt(e,o,t,1,n,s,1),pt(e,o,t,0,n,s,-1),ft(1,s)):(pt(e,t,t,1,n,s,1),pt(e,t,t,0,n,s,-1),ft(1,s))}}(i,n,s=ye.normalize(ye.perp(i,e[1])),o,p,t):(pt(i,n,s,1,p,t,1),pt(i,n,s,0,p,t,-1),ft(1,t),Ge(i)||gt(i,p,n,a,!1,t))}}}function ut(e,t,i){for(var r=t;e[r+1]&&Be(e[r],e[r+1],i);)r++;return e.length-r>=2&&e.slice(r)}function ht(e,t){var i=ye.normalize(ye.add(e,t)),r=2/(1+Math.abs(ye.dot(e,i)));return ye.mult(i,r*r)}function ct(e,t,i,r,n,s,o){var a=ht(i,r);ye.lengthSq(a)>n?dt(rt.bevel,e,t,i,r,s,o):(pt(t,a,a,1,e,o,1),pt(t,a,a,0,e,o,-1),s||ft(1,o))}function dt(e,t,i,r,n,s,o){var a=ht(r,n),l=n[0]*r[1]-n[1]*r[0]>0;null!=o.texcoord_index&&(st[1]=t,ot[1]=t),l?(pt(i,a,a,1,t,o,1),pt(i,r,a,0,t,o,-1),s||ft(1,o),mt(i,ye.neg(r),a,ye.neg(n),a,st,ot,st,!1,e===rt.bevel,o),pt(i,a,a,1,t,o,1),pt(i,n,a,0,t,o,-1)):(pt(i,r,a,1,t,o,1),pt(i,a,a,0,t,o,-1),s||ft(1,o),mt(i,r,ye.neg(a),n,a,ot,st,ot,!1,e===rt.bevel,o),pt(i,n,a,1,t,o,1),pt(i,a,a,0,t,o,-1))}function ft(e,t){for(var i=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,n=0;n<e;n++)i.push(r+2*n+2),i.push(r+2*n+1),i.push(r+2*n+0),i.push(r+2*n+2),i.push(r+2*n+3),i.push(r+2*n+1),t.geom_count+=2}function pt(e,t,i,r,n,s,o){var a=s.vertex_template,l=s.vertex_data;a[0]=e[0],a[1]=e[1];let u=s.half_width*o;a[s.extrude_index+0]=t[0]*u,a[s.extrude_index+1]=t[1]*u,s.offset&&(a[s.offset_index+0]=i[0]*s.offset,a[s.offset_index+1]=i[1]*s.offset),null!=s.texcoord_index&&(a[s.texcoord_index+0]=65535*r,a[s.texcoord_index+1]=65535*n),l.addVertex(a)}var _t=[0,0];function mt(e,t,i,r,n,s,o,a,l,u,h){for(var c=t[0]*r[1]-t[1]*r[0],d=ye.dot(t,r),f=Math.atan2(c,d);f>=Math.PI;)f-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var i=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*i)}(f,h.half_width);if(p<1)return}var _=h.vertex_data.vertex_count,m=h.vertex_data.vertex_elements;pt(e,i,n,o[0],o[1],h,1),pt(e,t,n,s[0],s[1],h,1);var g=t,y=null!=h.texcoord_index;if(y)if(l)var b=ye.sub(s,o);else{_t=ye.copy(s);var v=ye.div(ye.sub(a,s),p)}var x=f/p;let w,A,T=f<0?-1:1;c>0?(w=2,A=1):(w=1,A=2);for(var k=0;k<p;k++)0===k&&f<0&&(g=ye.neg(g)),g=ye.rot(g,x),y&&(l?(b=ye.rot(b,x),_t[0]=b[0]+o[0],_t[1]=b[1]*h.texcoord_width*h.v_scale+o[1]):_t=ye.add(_t,v)),pt(e,g,n,_t[0],_t[1],h,T),m.push(_+k+w),m.push(_),m.push(_+k+A)}function gt(e,t,i,r,n,s){var o=ye.neg(i),a=null!=s.texcoord_index;switch(r){case it.square:var l;n?(l=[i[1],-i[0]],pt(e,ye.add(i,l),i,1,t,s,1),pt(e,ye.add(o,l),i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,i,i,1,t,s,1),pt(e,o,i,0,t,s,1)):(l=[-i[1],i[0]],pt(e,i,i,1,t,s,1),pt(e,o,i,0,t,s,1),a&&(t+=.5*s.texcoord_width*s.v_scale),pt(e,ye.add(i,l),i,1,t,s,1),pt(e,ye.add(o,l),i,0,t,s,1)),ft(1,s);break;case it.round:var u,h,c=st,d=ot,f=at;n?(u=i,h=o,a&&(t+=.5*s.texcoord_width*s.v_scale,c=ot,d=st,f=at)):(u=o,h=i),a&&(st[1]=t,ot[1]=t,at[1]=t),mt(e,u,tt,h,i,c,f,d,!0,!1,s);break;case it.butt:return}}const yt=[255,255,255,255],bt=[0,0,0,0],vt=Object.create(Pe);Object.assign(vt,{name:"lines",built_in:!0,vertex_shader_src:Ke,fragment_shader_src:Qe,selection:!0,init(){Pe.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>Q.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let i=this.calcDistance(e,t);return t.zoom--,i},calcWidth(e,t,i){let r,n=this.calcDistance(e.width,i);if(!(n<0)){if(r=e.next_width?this.calcDistanceNextZoom(e.next_width,i):n/2,0===n&&0===r||r<0)return!1;if(t.width_unscaled=n,t.next_width_unscaled=r,e.next_width){r*=2;let e=.5*(n+r);t.width=e*i.units_per_meter_overzoom,t.width_scale=1-r/e}else t.width=n*i.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*i.units_per_meter_overzoom/i.tile.overzoom2),!0}},calcOffset(e,t,i){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let r=this.calcDistance(e.offset,i);if(e.next_offset){let n=2*this.calcDistanceNextZoom(e.next_offset,i);Math.abs(r)>=Math.abs(n)?(t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0!==r?1-n/r:0):(t.offset=n*i.units_per_meter_overzoom,t.offset_scale=0!==n?-1*(1-r/n):0)}else t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,i){var r=this.feature_style;if(!1!==this.calcWidth(t,r,i)&&(this.calcOffset(t,r,i),r.color=this.parseColor(t.color,i),r.color)){if(r.alpha=Q.evalCachedProperty(t.alpha,i),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,r.height=e.properties.height||Q.defaults.height,r.extrude=Q.evalProperty(t.extrude,i),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=V.height_scale,r.cap=t.cap,r.join=t.join,r.miter_limit=t.miter_limit,r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,i),n=2*this.calcDistanceNextZoom(t.outline.next_width,i);0===e&&0===n||e<0||n<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=!1):(r.outline.width.value=e+r.width_unscaled,r.outline.next_width.value=n+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.alpha=t.outline.alpha,r.outline.interactive=t.outline.interactive,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.extrude=t.outline.extrude,r.outline.z=t.outline.z,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,i):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5)}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess(e){if(e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.width=Q.createPropertyCache(e.width,Q.parseUnits),e.width&&e.width.type!==Q.CACHE_TYPE.STATIC&&(e.next_width=Q.createPropertyCache(e.width,Q.parseUnits)),e.offset=e.offset&&Q.createPropertyCache(e.offset,Q.parseUnits),e.offset&&e.offset.type!==Q.CACHE_TYPE.STATIC&&(e.next_offset=Q.createPropertyCache(e.offset,Q.parseUnits)),e.z=Q.createPropertyCache(e.z,Q.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&Q.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.next_width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&Q.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const i=function(e,t={}){const i=t.dash_color||yt,r=t.background_color||bt,n=e,s=t.scale||1;n.length%2==1&&Array.prototype.push.apply(n,n);let o=!0,a=[];for(let e=0;e<n.length;e++){let t=Math.floor(n[e]*s);for(let e=0;e<t;e++)Array.prototype.push.apply(a,o?i:r);o=!o}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});S.create(this.gl,t,{data:i.pixels,height:i.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Pe.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=S.default,t.uniforms.u_v_scale_adjust=V.tile_scale;let i=[];for(let r in t.meshes){let n=t.meshes[r].variant;if(n.texture){let s=t.meshes[r].uniforms=t.meshes[r].uniforms||{};if(s.u_has_line_texture=!0,s.u_texture=n.texture,s.u_texture_ratio=1,n.dash&&(s.u_v_scale_adjust=20*V.tile_scale,s.u_has_dash=null!=n.dash_background_color?1:0,s.u_dash_background_color=n.dash_background_color||[0,0,0,0]),n.dash_key&&null==this.dash_textures[n.dash_key]){this.dash_textures[n.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",n.dash)}catch(e){m("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==S.textures[n.texture])i.push(S.syncTexturesToWorker([n.texture]).then(e=>{let t=e[n.texture];t&&(s.u_texture_ratio=t.height/t.width)}));else{let e=S.textures[n.texture];s.u_texture_ratio=e.height/e.width}}}await Promise.all(i)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const i=this.getBlendOrderForDraw(e);t+="/"+i,t=P(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:i,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:fe.SHORT,normalized:!1},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:fe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new De(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=1024*e.width_scale,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=0,this.vertex_template[i++]=0,t.variant.offset&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),t.variant.z_or_offset&&(this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},buildLines(e,t,i,r){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var n=this.styles[t.outline.style];n&&n.addFeature(i.feature,t.outline,i)}this.feature_style=this.inline_feature_style;let s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=s.vertex_data,a=o.vertex_layout;return function(e,t,i,r,n,s,o,a){var l,u=t.cap?it[t.cap]:it.butt,h=t.join?rt[t.join]:rt.miter;if(h===rt.miter){const e=t.miter_limit||3;var c=e*e}n.a_texcoord&&(l=1/(t.texcoord_width*nt));var d={closed_polygon:s,remove_tile_edges:o,tile_edge_tolerance:a,miter_len_sq:c,join_type:h,cap_type:u,vertex_data:i,vertex_template:r,half_width:t.width/2,extrude_index:n.a_extrude,offset_index:n.a_offset,v_scale:l,texcoord_index:n.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],d);if(d.extra_lines)for(let e=0;e<d.extra_lines.length;e++)lt(d.extra_lines[e],d);return d.geom_count}(e,t,o,this.makeVertexTemplate(t,s),a.index,r&&r.closed_polygon,!t.tile_edges&&r&&r.remove_tile_edges,V.tile_scale*i.tile.pad_scale*2)},buildPolygons(e,t,i){let r=0;for(let n=0;n<e.length;n++)r+=this.buildLines(e[n],t,i,{closed_polygon:!0,remove_tile_edges:!0});return r}});const xt=128/Math.PI,wt=16384/Math.PI,At=[0,2,2,0],Tt=[1,1,3,3],kt=new Array(4),Et=["left","top-left","bottom-left"],St=["right","top-right","bottom-right"],Rt=["top","top-left","top-right"],zt=["bottom","bottom-left","bottom-right"],Mt={computeOffset(e,t,i,r=null){if(!i||"center"===i)return e;let n=[e[0],e[1]];return r=r||this.default_buffer,this.isLeftAnchor(i)?(n[0]-=t[0]/2,"left"===i&&(n[0]-=r[0])):this.isRightAnchor(i)&&(n[0]+=t[0]/2,"right"===i&&(n[0]+=r[1])),this.isTopAnchor(i)?(n[1]-=t[1]/2,"top"===i&&(n[1]-=r[2])):this.isBottomAnchor(i)&&(n[1]+=t[1]/2,"bottom"===i&&(n[1]+=r[3])),n},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>Et.indexOf(e)>-1,isRightAnchor:e=>St.indexOf(e)>-1,isTopAnchor:e=>Rt.indexOf(e)>-1,isBottomAnchor:e=>zt.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Pt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Ot=[[1,0],[0,1]],Nt=[],Ct=[];let Lt,It,Ft,Dt;class Ut{constructor(e,t,i,r,n){this.dimension=[r/2,n/2],this.angle=i,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=ye.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ye.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],i=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-i,e[0]+t,e[1]-i,e[0]+t,e[1]+i,e[0]-t,e[1]+i],this.axis_0=Ot[0],this.axis_1=Ot[1];else{let r=Math.cos(this.angle)*t,n=Math.sin(this.angle)*t,s=-Math.sin(this.angle)*i,o=Math.cos(this.angle)*i;this.quad=[e[0]-r-s,e[1]-n-o,e[0]+r-s,e[1]+n-o,e[0]+r+s,e[1]+n+o,e[0]-r+s,e[1]-n+o],this.updateAxes()}}static projectToAxis(e,t,i){let r=e.quad;return Lt=r[0]*t[0]+r[1]*t[1],It=r[2]*t[0]+r[3]*t[1],Ft=r[4]*t[0]+r[5]*t[1],Dt=r[6]*t[0]+r[7]*t[1],i[0]=Math.min(Lt,It,Ft,Dt),i[1]=Math.max(Lt,It,Ft,Dt),i}static axisCollide(e,t,i,r){return Ut.projectToAxis(e,i,Nt),Ut.projectToAxis(t,i,Ct),!(Ct[0]>Nt[1]||Ct[1]<Nt[0]||(Ut.projectToAxis(e,r,Nt),Ut.projectToAxis(t,r,Ct),Ct[0]>Nt[1]||Ct[1]<Nt[0]))}static intersect(e,t){return Ut.axisCollide(e,t,e.axis_0,e.axis_1)&&Ut.axisCollide(e,t,t.axis_0,t.axis_1)}}class jt{constructor(e,t={}){this.id=jt.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Mt.alignForAnchor(this.anchor)}occluded(e,t=null){let i=!1,r=e.aabb,n=e.obb;return r.length>0&&function(e,t,i){for(let r=0;r<t.length&&(!Pt(e,t[r])||null==i(r));r++);}(this.aabb,r,e=>{if(!t||r[e]!==t.aabb)return 0===this.obb.angle&&0===n[e].angle||Ut.intersect(this.obb,n[e])?(i=!0,!0):void 0}),i}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-V.tile_scale&&this.aabb[0]<V.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-V.tile_scale&&this.aabb[2]<V.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-V.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-V.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}jt.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let i=0;i<e.aabbs.length;i++)t.aabb.push(e.aabbs[i]),t.obb.push(e.obbs[i])},jt.id=0,jt.id_prefix=0,jt.id_multiplier=0,jt.nextLabelId=function(){return jt.id_prefix+jt.id++*jt.id_multiplier},jt.epsilon=.9999;class Gt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let i=this.positions[e],r=t[0]-i[0],n=t[1]-i[1];if(r*r+n*n<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,i){if(t.repeat_distance&&t.repeat_group&&this.groups[i][t.repeat_group])return this.groups[i][t.repeat_group].check(e)}static add(e,t,i){t.repeat_distance&&t.repeat_group&&(null==this.groups[i][t.repeat_group]&&(this.groups[i][t.repeat_group]=new Gt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[i][t.repeat_group].add(e))}}Gt.groups={};class Vt{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const i=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=i[1];t<=i[3];t++){this.cells[t]=this.cells[t]||{};for(let r=i[0];r<=i[2];r++)this.cells[t][r]=this.cells[t][r]||{aabb:[],obb:[]},e.cells.push(this.cells[t][r])}}}const $t={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Vt(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:i=!1}={}){let r=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:i};null==r.complete&&(r.complete=new Promise((e,t)=>{r.resolve=e,r.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,i){let r=this.tiles[i];if(!r)return m("trace","Collision.collide() called with null tile",i,this.tiles,t,e),Promise.resolve([]);let n=r.objects;for(let i=0;i<e.length;i++){let r=e[i],s=r.label.layout.priority;n[s]=n[s]||{},n[s][t]=n[s][t]||[],n[s][t].push(r)}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(i),r.complete.then(()=>(r.resolve=null,r.labels[t]||[]))},endTile(e){let t=this.tiles[e],i=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Gt.clear(e);let r=Object.keys(t.objects).sort((e,t)=>e-t);for(let n=0;n<r.length;n++){let s=t.objects[r[n]];if(s)for(let r in s){let n=s[r];i[r]=i[r]||[];for(let s=0;s<n.length;s++){let o=n[s];this.canBePlaced(o,e,o.linked,t)?o.linked?this.canBePlaced(o.linked,e,o,t)?(o.show=!0,(o.label.breach||o.linked.label.breach)&&(o.label.breach=!0,o.linked.label.breach=!0),(o.label.may_repeat_across_tiles||o.linked.label.may_repeat_across_tiles)&&(o.label.may_repeat_across_tiles=!0,o.linked.label.may_repeat_across_tiles=!0),i[r].push(o),this.place(o,e,t),this.place(o.linked,e,t)):t.return_hidden&&(o.show=!1,i[r].push(o)):(o.show=!0,i[r].push(o),this.place(o,e,t)):t.return_hidden&&(o.show=!1,i[r].push(o))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const i=t.objects[e];if(i)for(const e in i)i[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,i=null,{repeat:r=!0}={}){let n=e.label,s=e.label.layout;if(null!=n.placed)return n.placed;let o=!s.collide;if(o||(o=this.grid&&n.cells?n.cells.reduce((e,t)=>(e&&n.discard(t,i&&i.label)&&(e=!1),e),!0):!n.discard(this.tiles[t].bboxes,i&&i.label)),o){if(!r||!Gt.check(n,s,t))return!0;n.placed=!1}else s.collide&&(n.placed=!1);return n.placed},place({label:e},t,{repeat:i=!0}){null==e.placed&&(i&&Gt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>jt.add(e,t)):jt.add(e,this.tiles[t].bboxes))}};class qt extends jt{constructor(e,t,i,r=0){super(t,i),this.type="point",this.position=[e[0],e[1]],this.angle=r,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Mt.computeOffset(this.offset,e.size,e.anchor,Mt.zero_buffer),this.offset=Mt.computeOffset(this.offset,e.size,this.anchor,Mt.zero_buffer),e.offset!==Q.zeroPair&&(this.offset===Q.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Mt.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*jt.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*jt.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new Ut(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let i=this.start_anchor_index;i<this.layout.anchor.length;i++)if(this.anchor=this.layout.anchor[i],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Wt=qt.PLACEMENT;function Zt(e,t,i){const r=[],n=i.placement,s=Math.max(t[0],t[1])*i.placement_min_length_ratio*i.units_per_pixel;if(n===Wt.SPACED){let n=function(e,t,i){let r=i.units_per_pixel,n=(i.placement_spacing||80)*r,s=function(e){let t=0;for(let i=0;i<e.length-1;i++)t+=Xt(e[i],e[i+1]);return t}(e);if(s<=t)return!1;let o=Math.max(Math.floor(s/n),1),a=[],l=[],u=.5*(s-(o-1)*n);for(let r=0;r<o;r++){let{position:r,angle:s}=Yt(e,u,t,i);null!=r&&null!=s&&(a.push(r),l.push(s)),u+=n}return{positions:a,angles:l}}(e,s,i);if(!n)return[];let o=n.positions,a=n.angles;for(let e=0;e<o.length;e++){let n=o[e],s=a[e];!0!==i.tile_edges&&Ge(n)||r.push(new qt(n,t,i,s))}}else if(n===Wt.VERTEX){let n,s;for(let o=0;o<e.length-1;o++)if(n=e[o],s=e[o+1],!0===i.tile_edges||!Ge(n)){const e=Ht(n,s,i.angle);r.push(new qt(n,t,i,e))}const o=Ht(n,s,i.angle);r.push(new qt(s,t,i,o))}else if(n===Wt.MIDPOINT)for(let n=0;n<e.length-1;n++){let o=e[n],a=e[n+1],l=[.5*(o[0]+a[0]),.5*(o[1]+a[1])];if((!0===i.tile_edges||!Ge(l))&&(!s||Xt(o,a)>s)){const e=Ht(o,a,i.angle);r.push(new qt(l,t,i,e))}}return r}function Ht(e,t,i=0){return"auto"===i?Math.atan2(t[0]-e[0],t[1]-e[1]):i}function Xt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Yt(e,t,i,r){let n,s,o=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const h=Xt(l,u);if(!(h<=i)&&(o+=h,o>t)){n=Jt(l,u,o-t),s=Ht(l,u,r.angle);break}}return{position:n,angle:s}}function Jt(e,t,i){let r=i/Xt(e,t);return[r*e[0]+(1-r)*t[0],r*e[1]+(1-r)*t[1]]}const Kt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,g.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const i={};e.font=e.font||this.defaults,i.supersample=e.supersample_text?1.5:1,i.can_articulate=e.can_articulate,i.fill=Q.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),i.fill=g.toCSSColor(i.fill),e.font.stroke&&e.font.stroke.color&&(i.stroke=Q.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),i.stroke=g.toCSSColor(i.stroke),i.stroke_width=Q.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||i.can_articulate||(i.underline_width=1.5*i.supersample),e.font.background&&!i.can_articulate&&(i.background_color=Q.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),i.background_color=g.toCSSColor(i.background_color),i.background_color&&(i.background_width=Q.evalCachedProperty(e.font.background.width,t)),i.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&Q.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),i.background_stroke_color&&(i.background_stroke_color=g.toCSSColor(i.background_stroke_color),i.background_stroke_width=null!=e.font.background.stroke.width?Q.evalCachedProperty(e.font.background.stroke.width,t):1)),i.weight=Q.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof i.weight&&(i.weight=Math.min(Math.max(i.weight,1),1e3)),e.font.family?(i.family=e.font.family,i.family!==this.defaults.family&&(i.family+=", "+this.defaults.family)):i.family=this.defaults.family,i.style=e.font.style||this.defaults.style,i.transform=e.font.transform,i.px_size=Q.evalCachedProperty(e.font.px_size,t)*i.supersample,i.font_css=this.fontCSS(i);let r=e.text_wrap;return null!=r||i.can_articulate||(r=!0),!0===r&&(r=this.defaults.text_wrap),i.text_wrap=r,i.max_lines=e.max_lines||this.defaults.max_lines,i},fontCSS:({style:e,weight:t,px_size:i,family:r})=>[e,t,i+"px",r].filter(e=>e).join(" ")};var Qt,ei,ti={exports:{}},ii=O((Qt||(Qt=1,ei=ti,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function i(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function r(e){var t=e.a.offsetWidth,i=t+100;return e.f.style.width=i+"px",e.c.scrollLeft=i,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function n(t,i){function n(){var e=s;r(e)&&e.a.parentNode&&i(e.g)}var s=t;e(t.b,n),e(t.c,n),r(t)}function s(e,t){var i=t||{};this.family=e,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}var o=null,a=null,l=null,u=null;function h(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function c(e,t){return[e.style,e.weight,h()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,r){var s=this,l=e||"BESbswy",h=0,d=r||3e3,f=(new Date).getTime();return new Promise(function(e,r){var p;if(null===u&&(u=!!document.fonts),(p=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!a),p){p=new Promise(function(e,t){!function i(){(new Date).getTime()-f>=d?t():document.fonts.load(c(s,'"'+s.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(i,25)},function(){t()})}()});var _=new Promise(function(e,t){h=setTimeout(t,d)});Promise.race([_,p]).then(function(){clearTimeout(h),e(s)},function(){r(s)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=m&&-1!=g||-1!=m&&-1!=y||-1!=g&&-1!=y)&&((t=m!=g&&m!=y&&g!=y)||(null===o&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),o=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=o&&(m==b&&g==b&&y==b||m==v&&g==v&&y==v||m==x&&g==x&&y==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(h),e(s))}var u=new t(l),p=new t(l),_=new t(l),m=-1,g=-1,y=-1,b=-1,v=-1,x=-1,w=document.createElement("div");w.dir="ltr",i(u,c(s,"sans-serif")),i(p,c(s,"serif")),i(_,c(s,"monospace")),w.appendChild(u.a),w.appendChild(p.a),w.appendChild(_.a),document.body.appendChild(w),b=u.a.offsetWidth,v=p.a.offsetWidth,x=_.a.offsetWidth,function e(){if((new Date).getTime()-f>=d)w.parentNode&&w.parentNode.removeChild(w),r(s);else{var t=document.hidden;!0!==t&&void 0!==t||(m=u.a.offsetWidth,g=p.a.offsetWidth,y=_.a.offsetWidth,a()),h=setTimeout(e,50)}}(),n(u,function(e){m=e,a()}),i(u,c(s,'"'+s.family+'",sans-serif')),n(p,function(e){g=e,a()}),i(p,c(s,'"'+s.family+'",serif')),n(_,function(e){y=e,a()}),i(_,c(s,'"'+s.family+'",monospace'))})})},ei.exports=s}()),ti.exports));const ri={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const i in e)Array.isArray(e[i])?e[i].forEach(e=>t.push(this.loadFontFace(i,e))):t.push(this.loadFontFace(i,e[i]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const i={family:e};"object"==typeof t&&(Object.assign(i,t),"string"==typeof t.url&&await this.injectFontFace(i));try{i.weight="string"==typeof i.weight?i.weight.split(" ")[0]:i.weight;const t=new ii(e,i);await t.load(),m("debug",`Font face '${e}' is available`,i)}catch(t){m("warn",`Font face '${e}' is NOT available`,i,t)}},async injectFontFace({family:e,url:t,weight:i,style:r}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let n=t;if("blob:"===t.slice(0,5)){n=(await g.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(n);if(this.supports_native_font_loading)n=e;else{let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);n="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof n?t=new FontFace(e,`url(${encodeURI(n)})`,{weight:i,style:r}):n instanceof Uint8Array&&(t=new FontFace(e,n,{weight:i,style:r})),document.fonts.add(t),m("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${i||"normal"};\n font-style: ${r||"normal"};\n src: url(${encodeURI(n)});\n }`,s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(t,0),m("trace","Injecting CSS font face:",t)}}},ni=new RegExp("[֑-߿‏‫‮יִ-﷽ﹰ-ﻼ]");function si(e){return ni.test(e)}const oi="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029‬ -⯿",ai=new RegExp("["+oi+"]+");function li(e){return ai.test(e)}const ui=new RegExp("^["+oi+"؀-ۿ]+"),hi=new RegExp("["+oi+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),ci=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),di="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-⃿]",fi=new RegExp(`^.(?:${di}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${di}+)?)*`),pi={Mongolian:"᠀-᢯"},_i=Object.keys(pi).map(e=>pi[e]).join(""),mi=new RegExp("["+_i+"]");function gi(e,t,i){const r=t?1:2;if(e.length<r)return[e];let n=e;if(i.segment[n])return i.stats.segment_hits++,i.segment[n];let s=[];if(ui.exec(e)){s=e.split(hi);let t=-1;for(var o=0;o<s.length-1;o++){if(o>0){let e=ci.exec(s[o]);e&&(s[o]=s[o].substring(e[0].length),s[o-1]+=e[0],t+=e[0].length)}t+=1+s[o].length,s[o]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",i=e,n=0;for(;n<r&&i.length;n++){let e=(fi.exec(i)||i)[0];t+=e,i=i.substring(e.length)}s.push(t),e=e.substring(t.length)}return t&&s.reverse(),i.stats.segment_misses++,i.segment[n]=s,s}class yi{constructor(e,t=1/0,i=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=i,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new bi(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(yi.ellipsis).width);e.append(yi.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,i,r,n){let s;s="number"==typeof t?e.split(" "):[e];let o=new yi(n,i,t),a=o.createLine(r);for(let e=0;e<s.length;e++){let i=s[e].split("\n"),n=0===e;for(let s=0;s<i.length&&a;s++){let l=i[s];si(l)&&li(l[l.length-1])&&(l+="‏");let u=n?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=o.advance(a,r),!a)break;a.append(l),n=!0}else a.append(u);s<i.length-1&&(a=o.advance(a,r),n=!0)}e===s.length-1&&o.finish(a)}return o}}yi.ellipsis="...";class bi{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function vi(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function xi(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?vi(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):vi(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}class wi{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:i,stroke_width:r,px_size:n,supersample:s}){this.px_size=n;let o=this.context,a=g.device_pixel_ratio*s;i&&r>0&&(o.strokeStyle=i,o.lineWidth=r*a),o.fillStyle=t,o.font=e,o.miterLimit=2}async textSizes(e,t){return await ri.loadFonts(),T.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:i}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let n=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(i[n]));let s=i[n],o=!0;for(;t.text_idx<t.texts.length;){let i=t.texts[t.text_idx],a=s[i],l=a.text_settings;if(o&&(this.setFont(l),o=!1),a.size=this.textSize(n,i,l).size,l.can_articulate){let e=!1,t=!1;if(si(i)&&(li(i)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(r=i,mi.test(r)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=gi(i,e,wi.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(n,t[e],l).size)}}if(t.text_idx++,!T.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var r;return T.finish(e,i),!0}textSize(e,t,{transform:i,text_wrap:r,max_lines:n,stroke_width:s=0,background_color:o,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:h}){if(wi.cache.text[e]=wi.cache.text[e]||{},wi.cache.text[e][t])return wi.cache.stats.text_hits++,wi.cache.text[e][t];wi.cache.stats.text_misses++,wi.cache.text_count++;const c=g.device_pixel_ratio*h,d=this.applyTextTransform(t,i),f=this.context,p=this.vertical_text_buffer*c,_=(s+this.horizontal_text_buffer)*c;l=null!=l?l:this.background_size;const m=o||a?(l+a)*c:0,y=(2+u+(u?s+1:0))*c,b=this.px_size+y;let{width:v,height:x,lines:w}=yi.parse(d,r,n,b,f);v+=2*m,x+=2*m;let A=[v/c,x/c],T=[v+2*_,x+2*p],k=[T[0]/c,T[1]/c];return wi.cache.text[e][t]={lines:w,size:{collision_size:A,texture_size:T,logical_size:k,horizontal_buffer:_,vertical_buffer:p,dpr:c,line_height:b,background_size:m}},wi.cache.text[e][t]}drawTextMultiLine(e,[t,i],r,n,s){const{dpr:o,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:h,vertical_buffer:c}=r;if(n.background_color||n.background_stroke_color){const e=n.background_stroke_color,r=(n.background_stroke_width||0)*o;this.context.save(),n.background_color&&(this.context.fillStyle=n.background_color,this.context.fillRect(t+h+("curved"===s?l[0]:0)+r,i+c+r,o*a[0]-2*r,o*a[1]-2*r)),e&&r&&(this.context.strokeStyle=e,this.context.lineWidth=r,this.context.strokeRect(t+h+("curved"===s?l[0]:0)+.5*r,i+c+.5*r,o*a[0]-r,o*a[1]-r)),this.context.restore()}const d=n.underline_width||0,f=n.stroke_width||0;let p=i-(d?.5*(d+f+1)*o:0);for(let i=0;i<e.length;i++){let o=e[i];this.drawTextLine(o,[t,p],r,n,s),p+=u}this.drawTextDebug([t,i],r,s)}drawTextLine(e,[t,i],r,n,s){const{stroke:o,stroke_width:a,transform:l,align:u="center"}=n,{horizontal_buffer:h,vertical_buffer:c,texture_size:d,background_size:f,line_height:p,dpr:_}=r,m=(n.underline_width||0)*_,g=this.applyTextTransform(e.text,l);let y;"left"===u?y=t+h+f:"center"===u?y=t+d[0]/2-e.width/2:"right"===u&&(y=t+d[0]-e.width-h-f);const b=i+.75*c+p+f-.5*m,v=o&&a>0&&"curved"===s?d[0]:0;if(m){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=m;const t=b+(.5*a+2)*_+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(y+v,t),this.context.lineTo(y+v+e.width,t),this.context.stroke(),this.context.restore()}o&&a>0&&this.context.strokeText(g,y+v,b),this.context.fillText(g,y,b)}drawTextDebug([e,t],i,r){const{dpr:n,horizontal_buffer:s,vertical_buffer:o,texture_size:a,collision_size:l}=i;b.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+s,t+o,n*l[0],n*l[1]),"curved"===r&&this.context.strokeRect(e+a[0]+s,t+o,n*l[0],n*l[1]),this.context.restore()),b.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===r&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,i,r,n){return T.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:r,gl:n,tile_id:i,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:i,texts:r,textures:n}=e;for(;i.texture_idx<e.textures.length;){for(t=n[i.texture_idx],i.texture_resize&&(i.texture_resize=!1,this.resize(...t.texture_size));i.style_idx<i.styles.length;){let n=i.styles[i.style_idx];null==i.text_idx&&(i.text_idx=0,i.texts=Object.keys(r[n]));let s=r[n],o=!0;for(;i.text_idx<i.texts.length;){let r=i.texts[i.text_idx],a=s[r],l=a.text_settings;if(o&&(this.setFont(l),o=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let s=a.type[e];if("straight"===s){if(a.textures[e]!==i.texture_idx)continue;let o,u=a.isRTL?r.split().reverse().join():r,h=t.texcoord_cache[n][u];if(h.texcoord)o=h.texcoord;else{let e=h.texture_position,{size:i,lines:r}=this.textSize(n,u,l);this.drawTextMultiLine(r,e,i,l,s),o=S.getTexcoordsForSprite(e,i.texture_size,t.texture_size),h.texcoord=o}a.texcoords[s]={texcoord:o,texture_id:h.texture_id}}else if("curved"===s){let r=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let o=0;o<r.length;o++){if(a.textures[e][o]!==i.texture_idx)continue;let u,h,c=r[o],d=t.texcoord_cache[n][c];if(d.texcoord)u=d.texcoord,h=d.texcoord_stroke,a.texcoords_stroke.push(h);else{let e=d.texture_position,{size:i,lines:r}=this.textSize(n,c,l);this.drawTextMultiLine(r,e,i,l,s),u=S.getTexcoordsForSprite(e,i.texture_size,t.texture_size);let o=[e[0]+i.texture_size[0],e[1]];h=S.getTexcoordsForSprite(o,i.texture_size,t.texture_size),d.texcoord=u,d.texcoord_stroke=h,a.texcoords_stroke.push(h)}a.texcoords.curved.push({texcoord:u,texture_id:d.texture_id})}}}}else{let e=this.textSize(n,r,l).lines;const s=xi({},l);for(let r in a.align)a.align[r].texture_id===i.texture_idx&&(s.align=r,this.drawTextMultiLine(e,a.align[r].texture_position,a.size,s),a.align[r].texcoords=S.getTexcoordsForSprite(a.align[r].texture_position,a.size.texture_size,t.texture_size))}if(i.text_idx++,!T.shouldContinue(e))return!1}i.text_idx=null,i.style_idx++}let s=e.texture_prefix+i.texture_idx;S.create(e.gl,s,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),S.retain(s),i.texture_names.push(s),i.texture_idx++,i.texture_resize=!0,i.style_idx=0}return T.finish(e,i.texture_names),!0}cancelRasterizeTask(e){m("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>S.release(e))}setTextureTextPositions(e,t){let i={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},r=[];for(let n in e){let s=e[n];for(let e in s){let o,a=s[e];if(a.text_settings.can_articulate){a.textures=[],i.texcoord_cache[n]=i.texcoord_cache[n]||{};for(let s=0;s<a.type.length;s++){let l=a.type[s];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!i.texcoord_cache[n][l]){let e=a.size.texture_size;o=this.placeText(e[0],e[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o}}a.textures[s]=i.texture_id}else if("curved"===l){a.textures[s]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!i.texcoord_cache[n][l]){let s=a.segment_sizes[e].texture_size,u=2*s[0];o=this.placeText(u,s[1],n,i,r,t),i.texcoord_cache[n][l]={texture_id:i.texture_id,texture_position:o}}a.textures[s].push(i.texture_id)}}}}else{let e=a.size.texture_size;for(let s in a.align)o=this.placeText(e[0],e[1],n,i,r,t),a.align[s].texture_id=i.texture_id,a.align[s].texture_position=o}}}return i.column_width>0&&i.height>0&&(r[i.texture_id]={texture_size:[i.width,i.height],texcoord_cache:i.texcoord_cache}),r}placeText(e,t,i,r,n,s){let o;return r.cy+t>s?(r.cx+=r.column_width,r.cy=0,r.column_width=e):r.column_width=Math.max(r.column_width,e),r.cx+r.column_width<=s?(o=[r.cx,r.cy],r.cy+=t,r.height=Math.max(r.height,r.cy),r.width=Math.max(r.width,r.cx+r.column_width)):(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache},r.texcoord_cache={},r.texcoord_cache[i]={},r.texture_id++,r.cx=0,r.cy=t,r.column_width=e,r.width=e,r.height=t,o=[0,0]),o}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,i]=e.match(wi.font_size_re)||[];return i=i||"px","em"===i?t*=16:"pt"===i?t/=.75:"%"===i&&(t/=6.25),t=Q.parsePositiveNumber(t),t*=g.device_pixel_ratio,t}static pruneTextCache(){wi.cache.text_count>wi.cache.text_count_max&&(wi.cache.text={},wi.cache.text_count=0,m("debug","TextCanvas: pruning text cache")),Object.keys(wi.cache.segment).length>wi.cache.segment_count_max&&(wi.cache.segment={},m("debug","TextCanvas: pruning segment cache"))}}function Ai(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}wi.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,wi.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Ti=0;const ki={resetText(){t.is_main?this.canvas=new wi:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,i,r){let n=this.parseTextSource(e,t,i);if(null==n||""===n)return;let s=Kt.compute(t,i),o=Kt.key(s);this.texts[r.id]=this.texts[r.id]||{};let a=this.texts[r.id][o]=this.texts[r.id][o]||{};if(n instanceof Object){let l=[],u=n.left+"-"+n.right;for(let h in n){let c=n[h];if(!c)continue;let d=this.computeTextLayout({},e,t,i,r,c,s,u,h);a[c]||(a[c]={text_settings:s,ref:0}),l.push({draw:t,text:c,text_settings_key:o,layout:d})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,i,r,n,s);return a[n]||(a[n]={text_settings:s,ref:0}),{draw:t,text:n,text_settings_key:o,layout:l}}},parseTextSource(e,t,i){let r,n=t.text_source||"name";if(null==n||Array.isArray(n)||"object"!=typeof n)r=this.parseTextSourceValue(n,e,i);else{r={};for(let t in n)r[t]=this.parseTextSourceValue(n[t],e,i)}return r},parseTextSourceValue(e,t,i){let r;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if("string"==typeof e[n]?r=t.properties[e[n]]:"function"==typeof e[n]&&(r=e[n](i)),r)return r}else"string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(i));return r},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const i=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(m("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=i||[],i?this.buildTextLabels(e,t):($t.abortTile(e.id),[]))}catch(t){return $t.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,i){let r=await this.prepareTextLabels(e,i);if(0===r.length)return $t.collide([],t,e.id),{};if(r=await $t.collide(r,t,e.id),e.canceled)return m("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let s=this.texts[e.id];if(null==s||0===r.length)return{};this.cullTextStyles(s,r),r.forEach(e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text];i.text_settings.can_articulate?(i.type||(i.type=[]),-1===i.type.indexOf(e.label.type)&&i.type.push(e.label.type)):(i.align=i.align||{},i.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s);return e.canceled?(m("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ai(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({labels:r},t)}catch(e){return{}}},cullTextStyles(e,t){for(let i=0;i<t.length;i++){let r=t[i];e[r.text_settings_key][r.text].ref++}for(let t in e)for(let i in e[t])e[t][i].ref<1&&delete e[t][i];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,i){let r=new wi,n=Math.min(this.max_texture_size,2048),s=r.setTextureTextPositions(i,n),o=["labels",this.name,t,e,Ti,""].join("-");return Ti++,s=await r.rasterize(i,s,e,o,this.gl),s?{texts:i,textures:s}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=Q.createPropertyCache(e.font.weight),e.font.fill=Q.createPropertyCache(e.font.fill||Kt.defaults.fill),e.font.alpha=Q.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Q.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Q.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=Q.createPropertyCache(e.font.background.color),e.font.background.alpha=Q.createPropertyCache(e.font.background.alpha),e.font.background.width=Q.createPropertyCache(e.font.background.width,Q.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=Q.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=Q.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=Q.createPropertyCache(e.font.size||Kt.defaults.size,wi.fontPixelSize,wi.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Q.createPropertyCache(e.font.stroke.width,Q.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=Q.createPropertyCache(e.font.background.stroke.width,Q.parsePositiveNumber)),e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parsePositiveNumber),e},computeTextLayout(e,t,i,r,n,s,o,a,l){let u=e||{};return u=this.computeLayout(u,t,i,r,n),null==i.repeat_distance&&(u.repeat_distance="point"===r.geometry?0:V.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof i.repeat_group?u.repeat_group=i.repeat_group(r):u.repeat_group=i.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+s),u.subdiv=n.overzoom2,u.align=i.align,u.italic="normal"!==o.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var Ei,Si,Ri,zi,Mi,Pi,Oi,Ni,Ci,Li,Ii,Fi,Di,Ui,ji,Bi,Gi=O(Si?Ei:(Si=1,Ei=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],f=t[11],p=t[12],_=t[13],m=t[14],g=t[15],y=i*a-r*o,b=i*l-n*o,v=i*u-s*o,x=r*l-n*a,w=r*u-s*a,A=n*u-s*l,T=h*_-c*p,k=h*m-d*p,E=h*g-f*p,S=c*m-d*_,R=c*g-f*_,z=d*g-f*m,M=y*z-b*R+v*S+x*E-w*k+A*T;return M?(M=1/M,e[0]=(a*z-l*R+u*S)*M,e[1]=(l*E-o*z-u*k)*M,e[2]=(o*R-a*E+u*T)*M,e[3]=(n*R-r*z-s*S)*M,e[4]=(i*z-n*E+s*k)*M,e[5]=(r*E-i*R-s*T)*M,e[6]=(_*A-m*w+g*x)*M,e[7]=(m*v-p*A-g*b)*M,e[8]=(p*w-_*v+g*y)*M,e):null})),Vi=O(zi?Ri:(zi=1,Ri=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8],c=h*o-a*u,d=-h*s+a*l,f=u*s-o*l,p=i*c+r*d+n*f;return p?(p=1/p,e[0]=c*p,e[1]=(-h*r+n*u)*p,e[2]=(a*r-n*o)*p,e[3]=d*p,e[4]=(h*i-n*l)*p,e[5]=(-a*i+n*s)*p,e[6]=f*p,e[7]=(-u*i+r*l)*p,e[8]=(o*i-r*s)*p,e):null})),$i=O(Pi?Mi:(Pi=1,Mi=function(e,t,i){var r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],p=t[11],_=t[12],m=t[13],g=t[14],y=t[15],b=i[0],v=i[1],x=i[2],w=i[3];return e[0]=b*r+v*a+x*c+w*_,e[1]=b*n+v*l+x*d+w*m,e[2]=b*s+v*u+x*f+w*g,e[3]=b*o+v*h+x*p+w*y,b=i[4],v=i[5],x=i[6],w=i[7],e[4]=b*r+v*a+x*c+w*_,e[5]=b*n+v*l+x*d+w*m,e[6]=b*s+v*u+x*f+w*g,e[7]=b*o+v*h+x*p+w*y,b=i[8],v=i[9],x=i[10],w=i[11],e[8]=b*r+v*a+x*c+w*_,e[9]=b*n+v*l+x*d+w*m,e[10]=b*s+v*u+x*f+w*g,e[11]=b*o+v*h+x*p+w*y,b=i[12],v=i[13],x=i[14],w=i[15],e[12]=b*r+v*a+x*c+w*_,e[13]=b*n+v*l+x*d+w*m,e[14]=b*s+v*u+x*f+w*g,e[15]=b*o+v*h+x*p+w*y,e})),qi=O(Ni?Oi:(Ni=1,Oi=function(e,t,i){var r,n,s,o,a,l,u,h,c,d,f,p,_=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*_+t[4]*m+t[8]*g+t[12],e[13]=t[1]*_+t[5]*m+t[9]*g+t[13],e[14]=t[2]*_+t[6]*m+t[10]*g+t[14],e[15]=t[3]*_+t[7]*m+t[11]*g+t[15]):(r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],f=t[10],p=t[11],e[0]=r,e[1]=n,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=d,e[10]=f,e[11]=p,e[12]=r*_+a*m+c*g+t[12],e[13]=n*_+l*m+d*g+t[13],e[14]=s*_+u*m+f*g+t[14],e[15]=o*_+h*m+p*g+t[15]),e})),Wi=O(Li?Ci:(Li=1,Ci=function(e,t,i){var r=i[0],n=i[1],s=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Zi=O(Fi?Ii:(Fi=1,Ii=function(e,t,i,r,n){var s=1/Math.tan(t/2),o=1/(r-n);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+r)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*r*o,e[15]=0,e}));function Hi(){return Ui?Di:(Ui=1,Di=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Xi,Yi,Ji=function(){if(Bi)return ji;Bi=1;var e=Hi();return ji=function(t,i,r,n){var s,o,a,l,u,h,c,d,f,p,_=i[0],m=i[1],g=i[2],y=n[0],b=n[1],v=n[2],x=r[0],w=r[1],A=r[2];return Math.abs(_-x)<1e-6&&Math.abs(m-w)<1e-6&&Math.abs(g-A)<1e-6?e(t):(c=_-x,d=m-w,f=g-A,s=b*(f*=p=1/Math.sqrt(c*c+d*d+f*f))-v*(d*=p),o=v*(c*=p)-y*f,a=y*d-b*c,(p=Math.sqrt(s*s+o*o+a*a))?(s*=p=1/p,o*=p,a*=p):(s=0,o=0,a=0),l=d*a-f*o,u=f*s-c*a,h=c*o-d*s,(p=Math.sqrt(l*l+u*u+h*h))?(l*=p=1/p,u*=p,h*=p):(l=0,u=0,h=0),t[0]=s,t[1]=l,t[2]=c,t[3]=0,t[4]=o,t[5]=u,t[6]=d,t[7]=0,t[8]=a,t[9]=h,t[10]=f,t[11]=0,t[12]=-(s*_+o*m+a*g),t[13]=-(l*_+u*m+h*g),t[14]=-(c*_+d*m+f*g),t[15]=1,t)}}(),Ki=O(Ji),Qi=O(Hi()),er=O(Yi?Xi:(Yi=1,Xi=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const tr={fromValues(e,t,i){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=i,r}},ir={normalFromMat4:Gi,invert:Vi},rr={multiply:$i,translate:qi,scale:Wi,perspective:Zi,lookAt:Ki,identity:Qi,copy:er};class nr{constructor(e,t,i={}){this.view=t,this.position=i.position,this.zoom=i.zoom}static create(e,t,i){switch(i.type){case"isometric":return new or(e,t,i);case"flat":return new ar(e,t,i);default:return new sr(e,t,i)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){rr.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),ir.normalFromMat4(e.normal32,e.model_view32),ir.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class sr extends nr{constructor(e,t,i={}){super(e,t,i),this.type="perspective",this.focal_length=i.focal_length,this.fov=i.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=i.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),U.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:i,fov:r}){return t?(i=2*t/e,r=2*Math.atan(1/i)):(i?r=2*Math.atan(1/i):r&&(r=r*Math.PI/180,i=1/Math.tan(r/2)),t=e/2*i),{view_height:e,height:t,focal_length:i,fov:r}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:i}=this.constrainCamera({view_height:e,focal_length:g.interpolate(this.view.zoom,this.focal_length),fov:g.interpolate(this.view.zoom,this.fov)}),r=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=r,rr.lookAt(this.view_matrix,tr.fromValues(r[0],r[1],0),tr.fromValues(r[0],r[1],-1),tr.fromValues(0,1,0)),rr.perspective(this.projection_matrix,i,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],rr.translate(this.projection_matrix,this.projection_matrix,tr.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),rr.translate(this.projection_matrix,this.projection_matrix,tr.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class or extends nr{constructor(e,t,i={}){super(e,t,i),this.type="isometric",this.axis=i.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),U.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,rr.identity(this.view_matrix),rr.translate(this.view_matrix,this.view_matrix,tr.fromValues(-e[0],-e[1],0)),rr.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,rr.scale(this.projection_matrix,this.projection_matrix,tr.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class ar extends or{constructor(e,t,i={}){super(e,t,i),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const lr=qt.PLACEMENT,ur=Object.create(Pe),hr="__shader_point";Object.assign(ur,ki),Object.assign(ur,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Pe.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===b.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==b.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===b.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===b.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n,s={};if(s.color=this.parseColor(t.color,i),s.texture=t.texture,s.label_texture=null,s.blend_order=t.blend_order,!s.color&&!s.texture)return;if(s.alpha=Q.evalCachedProperty(t.alpha,i),this.hasSprites(s)){if(n=this.parseSprite(s,t,i),!n)return void m({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${s.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(i=>{i&&m("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});s.texcoords=n.texcoords}else if(t.sprite)return void m({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,s,n,i),t.outline&&(s.outline_width=Q.evalCachedProperty(t.outline.width,i)||Q.defaults.outline.width,s.outline_color=this.parseColor(t.outline.color,i)),s.outline_edge_pct=0,s.outline_width&&s.outline_color){let e=s.outline_width;s.size[0]+=e,s.size[1]+=e,s.outline_edge_pct=e/Math.min(s.size[0],s.size[1])*2,s.outline_alpha=Q.evalCachedProperty(t.outline.alpha,i)}s.size[0]=Math.min(s.size[0],256),s.size[1]=Math.min(s.size[1],256),s.placement=t.placement,s.placement_min_length_ratio=Q.evalCachedProperty(t.placement_min_length_ratio,i),s.placement===lr.SPACED&&t.placement_spacing&&(s.placement_spacing=Q.evalCachedProperty(t.placement_spacing,i)),s.angle=Q.evalProperty(t.angle,i)||0,s.z=Q.evalCachedDistanceProperty(t.z,i)||Q.defaults.z,s.tile_edges=t.tile_edges,this.computeLayout(s,e,t,i,r);let o=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,i,r);Array.isArray(o)&&(o=null,m({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),o&&(o.layout.parent=s,o.layout.priority=t.text.priority?Math.max(o.layout.priority,s.priority+.5):s.priority+.5,$t.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:i,style:s,text_feature:o},r),$t.addStyle(this.collision_group_points,r.id)},calcSize(e,t,i,r){if(t.size=e.size,t.size){if(t.size=Q.evalCachedPointSizeProperty(e.size,i,S.textures[t.texture],r),null==t.size)return void m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=i&&i.css_size||[16,16]},hasSprites:e=>e.texture&&S.textures[e.texture]&&S.textures[e.texture].sprites,getSpriteInfo(e,t){let i=S.textures[e.texture].sprites[t]&&S.getSpriteInfo(e.texture,t);return t&&!i?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(m("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):i&&(i.sprite=t),i},parseSprite(e,t,i){let r=Q.evalProperty(t.sprite,i);return this.getSpriteInfo(e,r)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return m("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let i=[],r=[];t.forEach(e=>{let t=e.style,n=e.feature,s=n.geometry,o=this.buildLabels(t.size,s,t);for(let s=0;s<o.length;s++){let a=o[s],l={feature:n,draw:e.draw,context:e.context,style:t,label:a};if(r.push(l),e.text_feature){let t={feature:n,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};i.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:n,texts:s,textures:o}]=await Promise.all([$t.collide(r,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Pe.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,i)]);n&&s&&n.forEach(e=>{let t=e.text_settings_key,i=s[t]&&s[t][e.text],r=this.feature_style;r.label=e.label,r.linked=e.linked,r.size=i.size.logical_size,r.texcoords=i.align[e.label.align].texcoords,r.label_texture=o[i.align[e.label.align].texture_id],r.blend_order=e.draw.blend_order,Pe.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Pe.endData.call(this,e);return a&&o&&o.length&&(a.textures=a.textures||[],a.textures.push(...o)),a},_preprocess(e){e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parsePositiveNumber)),e.z=Q.createPropertyCache(e.z,Q.parseUnits);try{e.size=Q.createPointSizePropertyCache(e.size,e.texture)}catch(t){return m({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parseNumber),e.placement=lr[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=lr.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=Q.createPropertyCache(e.placement_spacing,Q.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=Q.createPropertyCache(e.placement_min_length_ratio,Q.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,i,r,n){let s=e||{};s.id=t,s.units_per_pixel=n.units_per_pixel||1,s.collide=!1!==i.collide,s.anchor=i.anchor,s.offset=Q.evalCachedProperty(i.offset,r)||Q.zeroPair,s.buffer=Q.evalCachedProperty(i.buffer,r)||Q.zeroPair,s.repeat_distance=Q.evalCachedProperty(i.repeat_distance,r),s.repeat_distance&&(s.repeat_distance*=s.units_per_pixel,s.repeat_scale=1,"function"==typeof i.repeat_group?s.repeat_group=i.repeat_group(r):s.repeat_group=i.repeat_group||r.layer);let o=i.priority;return null!=o?"function"==typeof o&&(o=o(r)):o=-1>>>0,s.priority=o,s},buildTextLabels(e,t){let i=[];for(let r=0;r<t.length;r++){let n=t[r],s=this.texts[e.id][n.text_settings_key][n.text].size.collision_size;n.label=new qt(n.point_label.position,s,n.layout),i.push(n)}return i},buildLabels(e,t,i){let r=[];if("Point"===t.type)r.push(new qt(t.coordinates,e,i,i.angle));else if("MultiPoint"===t.type){let n=t.coordinates;for(let t=0;t<n.length;++t){let s=n[t];r.push(new qt(s,e,i,i.angle))}}else if("LineString"===t.type){let n=Zt(t.coordinates,e,i);for(let e=0;e<n.length;++e)r.push(n[e])}else if("MultiLineString"===t.type){let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Zt(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e])}}else if("Polygon"===t.type)if(i.placement===lr.CENTROID){let n=V.centroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle))}else{let n=t.coordinates;for(let t=0;t<n.length;t++){let s=Zt(n[t],e,i);for(let e=0;e<s.length;++e)r.push(s[e])}}else if("MultiPolygon"===t.type)if(i.placement===lr.CENTROID){let n=V.multiCentroid(t.coordinates);n&&r.push(new qt(n,e,i,i.angle))}else{let n=t.coordinates;for(let t=0;t<n.length;t++){let s=n[t];for(let t=0;t<s.length;t++){let n=Zt(s[t],e,i);for(let e=0;e<n.length;++e)r.push(n[e])}}}return r},makeVertexTemplate(e,t,i=!0){let r=0;this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=0,this.vertex_template[r++]=0;const n=e.color||Q.defaults.color;if(this.vertex_template[r++]=255*n[0],this.vertex_template[r++]=255*n[1],this.vertex_template[r++]=255*n[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:n[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||Q.defaults.outline.color;this.vertex_template[r++]=255*t[0],this.vertex_template[r++]=255*t[1],this.vertex_template[r++]=255*t[2],this.vertex_template[r++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[r++]=e.outline_edge_pct||Q.defaults.outline.width}return i&&this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildQuad:(e,t,i,r,n,s,o,a,l,u,h)=>t[0]<=0||t[1]<=0?0:function(e,t,i,r,n,s,o,a,l,u,h,c){const d=128*n[0],f=128*n[1];kt[0]=-d,kt[1]=-f,kt[2]=d,kt[3]=f;const p=h||je,_=t.vertex_elements;let m=t.vertex_count;for(let n=0;n<4;n++)i[r.a_position+0]=e[0],i[r.a_position+1]=e[1],i[r.a_shape+0]=kt[At[n]],i[r.a_shape+1]=kt[Tt[n]],i[r.a_shape+2]=l,i[r.a_offset+0]=s[0],i[r.a_offset+1]=s[1],r.a_texcoord&&(i[r.a_texcoord+0]=65535*p[At[n]],i[r.a_texcoord+1]=65535*p[Tt[n]]),c&&(i[r.a_pre_angles+0]=xt*a[0],i[r.a_pre_angles+1]=xt*a[1],i[r.a_pre_angles+2]=xt*a[2],i[r.a_pre_angles+3]=xt*a[3],i[r.a_angles+0]=wt*u[0],i[r.a_angles+1]=wt*u[1],i[r.a_angles+2]=wt*u[2],i[r.a_angles+3]=wt*u[3],i[r.a_offsets+0]=64*o[0],i[r.a_offsets+1]=64*o[1],i[r.a_offsets+2]=64*o[2],i[r.a_offsets+3]=64*o[3]),t.addVertex(i);return _.push(m+0),_.push(m+1),_.push(m+2),_.push(m+2),_.push(m+3),_.push(m+0),2}(e,u,h,u.vertex_layout.index,t,s,o,n,4096*i,r,a,l),build(e,t){let i=e.label;return"curved"===i.type?this.buildCurvedLabel(i,e,t):this.buildStraightLabel(i,e,t)},buildStraightLabel(e,t,i){let r,n,s=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),o=this.makeVertexTemplate(t,s);"point"!==e.type?(r=t.size[e.type],n=t.texcoords[e.type].texcoord):(r=t.size,n=t.texcoords),s.uniforms=s.uniforms||{},t.label_texture?(s.uniforms.u_texture=t.label_texture,s.uniforms.u_point_type=2,s.uniforms.u_apply_color_blocks=!1):t.texture?(s.uniforms.u_texture=t.texture,s.uniforms.u_point_type=1,s.uniforms.u_apply_color_blocks=!0):(s.uniforms.u_texture=S.default,s.uniforms.u_point_type=3,s.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,r,e.angle,null,null,a,null,n,!1,s.vertex_data,o);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,s,l,i),l},buildCurvedLabel(e,t,i){let r,n,s=0;for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords_stroke[o];t.label_texture=t.label_textures[o],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(h,a,e.angle,c,f,u,d,l,!0,r.vertex_data,n);s+=p;const _=t.linked&&t.linked.label.id;this.trackLabel(e,_,r,p,i)}for(let o=0;o<e.num_segments;o++){let a=t.size[e.type][o],l=t.texcoords[e.type][o].texcoord;t.label_texture=t.label_textures[o],r=this.getTileMesh(i.tile,this.meshVariantTypeForDraw(t)),n=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],h=e.position,c=e.angles[o],d=e.offsets[o],f=e.pre_angles[o],p=this.buildQuad(h,a,e.angle,c,f,u,d,l,!0,r.vertex_data,n);s+=p;const _=t.linked&&t.linked.label.id;this.trackLabel(e,_,r,p,i)}return s},trackLabel(e,t,i,r){if(e.layout.collide||e.may_repeat_across_tiles){i.labels=i.labels||{},i.labels[e.id]=i.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const n=2*r,s=i.vertex_data.offset-i.vertex_data.stride*n;i.labels[e.id].ranges.push([s,n])}},buildLines(e,t,i){return this.build(t,i)},buildPoints(e,t,i){return this.build(t,i)},buildPolygons(e,t,i){return this.build(t,i)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:fe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new De(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||hr,i=t+"/"+e.blend_order;return null==this.variants[i]&&(this.variants[i]={key:i,selection:1,shader_point:t===hr,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[i]},makeMesh(e,t,i={}){return i=Object.assign({},i,{fade_in_time:this.fade_in_time}),Pe.makeMesh.call(this,e,t,i)}});const cr=[0,.33,.66,.99];let dr=function(e,t,i,r){const n=[{type:"straight",tolerance:r.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let s=0;s<n.length;s++){let o,a=n[s];if("straight"===a.type?o=new pr(t,i,r,a.tolerance):"curved"===a.type&&!r.no_curving&&i.length>2&&(o=new _r(e,i,r)),o&&!o.throw_away)return o}return!1};class fr{constructor(e){this.id=jt.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],i=0,r=0,n=0,s=t,o=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],h=ye.length(ye.sub(l,u));l[0]>u[0]?1===n?(t.push(l),i+=h,i>r&&(s=t,r=i,o=!1)):(t=[u,l],i=h,i>r&&(s=t,r=i,o=!1),n=1):l[0]<u[0]?-1===n?(t.unshift(l),i+=h,i>r&&(s=t,r=i,o=!0)):(t=[l,u],i=h,i>r&&(s=t,r=i,o=!0),n=-1):(-1===n?t.unshift(l):(t.push(l),n=1),i+=h,i>r&&(s=t,r=i,o=-1===n))}return[s,o]}discard(e,t=null){if(this.throw_away)return!0;for(let i=0;i<this.obbs.length;i++){let r={aabb:this.aabbs[i],obb:this.obbs[i]};if(jt.prototype.occluded.call(r,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!jt.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,i,r,n,s,o){let a=e[0],l=e[1];return!s||0===s[0]&&0===s[1]||(a+=(s=ye.rot(s,n))[0]*o,l-=s[1]*o),new Ut(a,l,-r,t,i)}}class pr extends fr{constructor(e,t,i,r){super(i),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,i,r)}fit(e,t,i,r){let n,s=this.unit_scale;[t,n]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(e[1]-i.vertical_buffer),n&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let o=yr(t),a=e[0]*s;for(let n=0;n<t.length-1;n++){let s,l=t[n],u=0,h=0,c=n+1;for(;c<t.length;){let d=t[c-1],f=t[c],p=gr(d,f);if(c!==n+1&&(u+=br(p,s)),Math.abs(u)>.1)break;if(h+=o[c-1],mr(h,a)<r){let t=ye.mult(ye.add(l,f),.5);return this.angle=-p,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof i.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}s=p,c++}}return!1}updateBBoxes(e,t,i,r,n){let s=this.unit_scale;this.obbs=[],this.aabbs=[];let o=(t[0]+2*this.layout.buffer[0])*s*jt.epsilon,a=(t[1]+2*this.layout.buffer[1])*s*jt.epsilon,l=fr.createOBB(e,o,a,i,r,n,s),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class _r extends fr{constructor(e,t,i){super(i),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,i)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,i){let r,n=this.unit_scale,s=Math.max(...e.map(e=>e[1])),o=s*n;[t,r]=fr.splitLineByOrientation(t),"number"==typeof i.orientation&&(this.offset[1]+=1.2*(s-i.vertical_buffer),r&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));let a=yr(t),l=e.map(e=>e[0]*n),u=a.reduce((e,t)=>e+t,0),h=l.reduce((e,t)=>e+t,0);if(h>u)return!1;let c=t.length-1;if(c-0<2)return!1;let d=_r.curvaturePlacement(t,u,a,h,0,c),f=t[d];if(-1===d||c-d<2)return!1;this.position=f;for(var p=0;p<l.length;p++){this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var _=0;_<cr.length;_++){let e=cr[_],[i,r]=_r.scaleLine(e,t);f=i[d];let{positions:s,offsets:a,angles:u,pre_angles:h}=_r.placeAtIndex(d,i,r,l),c=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/n);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<s.length;e++){let t=s[e],i=h[e],r=l[e],a=i+u[e],c=this.angle,d=fr.createOBB(t,r,o,a,c,this.offset,n),f=d.getExtent();this.obbs.push(d),this.aabbs.push(f)}}this.offsets[p].push(c[p]),this.angles[p].push(u[p]),this.pre_angles[p].push(h[p])}}return!0}static curvaturePlacement(e,t,i,r,n,s){n=n||0,s=s||e.length-1;var o=[];for(let t=n+1;t<s;t++){var a=e[t-1],l=e[t],u=e[t+1],h=ye.perp(l,a),c=ye.perp(u,l),d=ye.angleBetween(h,c);d>1&&(d=1/0),o.push(d)}o.push(1/0);var f=[],p=[],_=n,m=0;for(let e=0;e<n;e++)m+=i[e];for(;m+r<t;){for(var g=m+r,y=m,b=_,v=0;b<s&&y+i[b]<g&&(v+=o[b])!==1/0;)y+=i[b],b++;if(0===v)return _;var x=v/(b-_);f.push(v),p.push(x),m+=i[_],_++}if(0===f.length)return-1;var w=Math.min.apply(null,f),A=p[f.indexOf(w)];return w<1.3&&A<.4?f.indexOf(w):-1}static scaleLine(e,t){var i=[t[0]],r=[];return t.forEach((n,s)=>{if(s!==t.length-1){var o=ye.sub(t[s+1],t[s]),a=ye.mult(o,1+e);i.push(ye.add(i[s],a)),r.push(ye.length(a))}}),[i,r]}static placeAtIndex(e,t,i,r){let n=t[e],[s,o]=_r.getIndicesAndOffsets(e,i,r),a=_r.getPositionsFromIndicesAndOffsets(t,s,o),[l,u,h]=_r.getAnglesFromIndicesAndOffsets(n,s,t,a);return{positions:a,offsets:l,angles:u,pre_angles:h}}static getIndicesAndOffsets(e,t,i){let r=i.length,n=[],s=[],o=0,a=0,l=0;for(;o<r;){let u=i[o];for(;o<r&&a+.5*u<=l+t[e];){let t=a-l+.5*u;s.push(t),n.push(e),a+=u,o++,u=i[o]}l+=t[e],e++}return[n,s]}static getPositionsFromIndicesAndOffsets(e,t,i){let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=i[n],a=gr(e[s],e[s+1]),l=ye.rot([o,0],a),u=ye.add(e[s],l);r.push(u)}return r}static getAnglesFromIndicesAndOffsets(e,t,i,r){let n=[],s=[],o=[];for(let a=0;a<r.length;a++){let l=r[a],u=t[a],h=ye.sub(l,e),c=-ye.angle(h),d=-gr(i[u],i[u+1])-c;if(a>0){let e=n[a-1],t=s[a-1];Math.abs(c-e)>Math.PI&&(c+=c>e?-2*Math.PI:2*Math.PI),Math.abs(t-d)>Math.PI&&(d+=d>t?-2*Math.PI:2*Math.PI)}n.push(c),s.push(d),o.push(h)}return[o,n,s]}}function mr(e,t){return t/e}function gr(e,t){let i=ye.sub(t,e);return ye.angle(i)}function yr(e){let t=[];for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1],s=Math.hypot(r[0]-n[0],r[1]-n[1]);t.push(s)}return t}function br(e,t){let i,r;for(e>t?(i=t,r=e):(i=e,r=t);r-i>Math.PI;)i+=2*Math.PI;return Math.abs(r-i)}let vr=Object.create(ur);Object.assign(vr,{name:"text",super:ur,built_in:!0,init(e={}){Pe.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let i=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[i++]=0;return this.addCustomAttributesToVertexTemplate(e,i),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,i){let r=i.tile;if(r.generation!==this.generation)return;let n=e.geometry.type;t.can_articulate="LineString"===n||"MultiLineString"===n,t.supersample_text="LineString"===n||"MultiLineString"===n;let s=this.parseTextFeature(e,t,i,r);s&&(s instanceof Array?s.forEach(t=>{t.feature=e,t.context=i,t.layout.vertex=!1,this.queueFeature(t,r)}):(s.feature=e,s.context=i,s.layout.vertex=!1,this.queueFeature(s,r)),$t.addStyle(this.name,r.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:i,texts:r,textures:n}=await this.collideAndRenderTextLabels(e,this.name,t);i&&r&&(this.texts[e.id]=r,i.forEach(t=>{let i=t.text_settings_key,r=this.texts[e.id][i]&&this.texts[e.id][i][t.text],s=this.feature_style;s.label=t.label,r.text_settings.can_articulate?(s.size={},s.texcoords={},"straight"===t.label.type?(s.size.straight=r.size.logical_size,s.texcoords.straight=r.texcoords.straight,s.label_texture=n[r.texcoords.straight.texture_id]):(s.size.curved=r.segment_sizes.map(function(e){return e.logical_size}),s.texcoords_stroke=r.texcoords_stroke,s.texcoords.curved=r.texcoords.curved,s.label_textures=r.texcoords.curved.map(e=>n[e.texture_id]))):(s.size=r.size.logical_size,s.texcoords=r.align[t.label.align].texcoords,s.label_texture=n[r.align[t.label.align].texture_id]),s.blend_order=t.draw.blend_order,Pe.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const s=await Pe.endData.call(this,e);if(s){n&&n.length&&s.textures.push(...n);for(let e in s.meshes)s.meshes[e].uniforms.u_apply_color_blocks=!0}return s},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let i=[];for(let n=0;n<t.length;n++){let s,o=t[n],a=this.texts[e.id][o.text_settings_key][o.text];if(o.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var r=a.segment_sizes.map(e=>e.collision_size);o.layout.no_curving=a.no_curving,s=this.buildLabels(r,o.feature.geometry,o.layout,a.size.collision_size)}else s=this.buildLabels(a.size.collision_size,o.feature.geometry,o.layout);for(let e=0;e<s.length;e++){let t=Object.create(o);t.label=s[e],i.push(t)}}return i},buildLabels(e,t,i,r){let n=[];if("LineString"===t.type)Array.prototype.push.apply(n,this.buildLineLabels(t.coordinates,e,i,r));else if("MultiLineString"===t.type){let s=t.coordinates;for(let t=0;t<s.length;++t)Array.prototype.push.apply(n,this.buildLineLabels(s[t],e,i,r))}else if("Point"===t.type)n.push(new qt(t.coordinates,e,i));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t)n.push(new qt(r[t],e,i))}else if("Polygon"===t.type){let r=V.centroid(t.coordinates);r&&n.push(new qt(r,e,i))}else if("MultiPolygon"===t.type){let r=V.multiCentroid(t.coordinates);r&&n.push(new qt(r,e,i))}return n},buildLineLabels(e,t,i,r){let n=[],s=Math.min(i.subdiv,e.length-1);if(s>1){let o=(e.length-1)/s;for(let a=0;a<s;a++){let s=Math.floor(a*o),l=Math.floor((a+1)*o)+1,u=e.slice(s,l),h=dr(t,r,u,i);h&&n.push(h)}}if(n.length<s){let s=dr(t,r,e,i);s&&n.push(s)}return n},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:fe.SHORT,normalized:!1},{name:"a_shape",size:4,type:fe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:fe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:fe.SHORT,normalized:!1},{name:"a_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:fe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:fe.BYTE,normalized:!1},{name:"a_angles",size:4,type:fe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:fe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new De(t)}return this.vertex_layouts[e.shader_point]}}),vr.texture_id=0;let xr=Object.create(et);function wr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Ar(e){return null!=e}function Tr(e){return"("+e+")"}function kr(e){return"string"==typeof e?'"'+e+'"':e}function Er(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function Sr(e,t){return Tr(kr(t)+" === "+Er(e))}function Rr(e,t){return Tr(`${"["+t.map(kr).join(",")+"]"}.indexOf(${Er(e)}) > -1`)}function zr(e,t){return Tr(e.filter(Ar).map(function(e){return Tr(e.join(" && "))}).join(" "+t+" "))}function Mr(e,t,i){return t&&t.length>0?zr(t.map(function(e){return Fr(e,i)}),"||"):"true"}function Pr(e,t,i){return t&&t.length>0?zr(t.map(function(e){return Fr(e,i)}),"&&"):"true"}function Or(e,t,i){return"!"+Tr(Fr(t,i).join(" && "))}function Nr(e,t,i){return"!"+Tr(Mr(0,t,i))}function Cr(e,t){return Tr(Er(e)+(t?" != ":" == ")+"null")}function Lr(e,t,i){var r=[],n=i&&"function"==typeof i.rangeTransform&&i.rangeTransform;if(t.max){var s=n?n(t.max):t.max;r.push(Er(e)+" < "+s)}if(t.min){var o=n?o=n(t.min):t.min;r.push(Er(e)+" >= "+o)}return Tr(r.join(" && "))}function Ir(e,t){let i=[];if(t.includes_any){const r="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(kr).join(",")+"]";i.push(`${Er(e)} != null && ${r}.some(function(v) { return ${Er(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const r="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(kr).join(",")+"]";i.push(`${Er(e)} != null && ${r}.every(function(v) { return ${Er(e)}.indexOf(v) > -1 })`)}return Tr(i.join(" && "))}function Fr(e,t){var i=[];if("function"==typeof e)return[Tr(e.toString()+"(context)")];if(Array.isArray(e))return[Mr(0,e,t)];if(null==e)return["true"];for(var r=Object.keys(e),n=0;n<r.length;n++){var s=r[n],o=e[s],a=typeof o;if("string"===a||"number"===a)i.push(Sr(s,o));else if("boolean"===a)i.push(Cr(s,o));else if("not"===s)i.push(Or(0,o,t));else if("any"===s)i.push(Mr(0,o,t));else if("all"===s)i.push(Pr(0,o,t));else if("none"===s)i.push(Nr(0,o,t));else if(Array.isArray(o))i.push(Rr(s,o));else if("object"===a&&null!=o)o.max||o.min?i.push(Lr(s,o,t)):(o.includes_any||o.includes_all)&&i.push(Ir(s,o));else{if(null!=o)throw new Error("Unknown Query syntax: "+o);i.push(" true ")}}return 0===r.length?["true"]:i}function Dr(e,t){return null==e?function(){return!0}:new Function("context","return "+Tr(Fr(e,t).join(" && "))+";")}Object.assign(xr,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||Q.defaults.color,this.super._preprocess.apply(this,arguments)}});const Ur=["filter","draw","visible","enabled","data","exclusive","priority"];let jr={};function Br(e,t){let i,r=0;for(let t=0;t<e.length;t++)e[t].length>r&&(r=e[t].length);if(0===r)return null;let n={visible:!0};for(let s=0;s<r;s++)i=[],e.forEach(e=>{e[s]&&e[s][t]&&-1===i.indexOf(e[s][t])&&i.push(e[s][t])}),0!==i.length&&G(n,...i);return!1===n.visible?null:n}const Gr=["any","all","not","none"];class Vr{constructor({layer:e,name:t,parent:i,draw:r,visible:n,enabled:s,filter:o,exclusive:a,priority:l,styles:u}){if(this.id=Vr.id++,this.config_data=e.data,this.parent=i,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=r,this.filter=o,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,s=void 0===s?n:s,this.enabled=!1!==s,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,m("warn",t),delete this.draw[e]}}build(){m("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=H(this.draw,Q.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let i=e.parent.calculatedDraw||[];t.push(...i)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=H(this.filter,Q.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void m("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=Dr(this.filter,Wr):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,m("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,i=e.max||V.max_style_zoom;for(let e=t;e<i;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Gr.indexOf(e)){let t=this.filter[e],i=typeof t,r=Array.isArray(t);if(!r&&"string"!==i&&"number"!==i)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),r?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,r?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let i=this.feature_prop_matches[t],r=e.feature.properties[i[0]];if(null==r||-1===i[1].indexOf(r))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let i=this.context_prop_matches[t],r=e[i[0]];if(null==r||-1===i[1].indexOf(r))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let i=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;i+=`failed with error '${t.message}', stack trace: ${t.stack}`,m("error",i,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,i){for(let r in t){let n=t[r];if("object"!=typeof n||Array.isArray(n)){let t=`Layer value must be an object: cannot create layer '${r}: ${JSON.stringify(n)}'`;t+=`, under parent layer '${e.full_name}'.`,i[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),m("warn",t)}else Hr(r,n,e,i)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const i=e.exclusive?1:-1;return e.priority>t.priority?i:e.priority<t.priority?-i:e.full_name<t.full_name?i:e.full_name>t.full_name?-i:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}Vr.id=0;class $r extends Vr{constructor(e){super(e),this.is_leaf=!0}}class qr extends Vr{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],i=[];if(Xr(e,[this],t,i),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],i=1;i<e.length;i++)t+="/"+e[i];return t}return e[0]}(i);if(void 0===jr[e]){let i=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),r={};for(let e=0;e<i.length;e++){let t=i[e];if(t)for(let e=0;e<t.length;e++){let i=t[e];for(let e in i)r[e]=!0}}for(let n in r)jr[e]=jr[e]||{},jr[e][n]=Br(i,n),jr[e][n]?(jr[e][n].key=e+"/"+n,jr[e][n].layers=t.map(e=>e&&e.full_name),jr[e][n].group=n):delete jr[e][n];jr[e]&&0===Object.keys(jr[e]).length&&(jr[e]=null)}return jr[e]}}}const Wr={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Zr(e){return Ur.indexOf(e)>-1}function Hr(e,t,i,r){let n={name:e,layer:t=null==t?{}:t,parent:i,styles:r},[s,o]=function(e){let t={},i={};for(let r in e)Zr(r)?t[r]=e[r]:i[r]=e[r];return[t,i]}(t),a=(l=o,0===Object.keys(l).length);var l;let u;u=a&&null!=i?$r:qr;let h=new u(Object.assign(n,s));return h.enabled&&(i&&i.addLayer(h),h.children_to_parse=a?null:o),h}function Xr(e,t,i,r){let n=!1,s=!1;if(0!==t.length){for(let o=0;o<t.length;o++){let a=t[o];if(a.is_leaf){if(a.doesMatch(e)&&(n=!0,i.push(a),r.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(n=!0,s=Xr(e,a.layers,i,r),s||(i.push(a),r.push(a.id)),a.exclusive))break}return n}}function Yr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Jr(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Yr(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}let Kr=0,Qr=0;class en{constructor({coords:e,style_z:t,source:i,workers:r,view:n}){this.id=Kr++,this.view=n,this.source=i,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=Ee.normalizedCoord(e,this.source),this.key=Ee.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=V.metersForTile(this.coords),this.max=V.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=V.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=V.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=V.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(r)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){T.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(g.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),en.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:i,styles:r,global:n}){let s=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,$t.startTile(e.id,{apply_repeat_groups:!0});for(let t in i){let o=i[t];if(!o||!o.config_data){m("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(o.config_data.source!==e.source)continue;let a=en.getDataForSource(s,o.config_data,t);for(let i=0;i<a.length;i++){let s=a[i],l=s.geom;if(l)for(let i=0;i<l.features.length;i++){let a=l.features[i];if(null==a.geometry)continue;let u=Q.getFeatureParseContext(a,e,n);u.winding=e.default_winding,u.source=e.source,u.layer=s.layer;let h=o.buildDrawGroups(u,!0);if(h){for(let e in h){let i=h[e],n=i.style||e,s=r[n];s?(i=s.preprocess(i),null!=i&&!1!==i.visible&&(u.layers=i.layers,s.addFeature(a,i,u))):m("warn",`Style '${n}' not found, skipping layer '${t}':`,i,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let o=this.stylesForTile(e,r).map(e=>r[e]);en.buildStyleGroups(e,o,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let i=[];for(let r in t)t[r].hasDataForTile(e)&&i.push(r);return i}static buildStyleGroups(e,t,i,r){const n=t.reduce((e,t)=>{const i=r(t);return e[i]=e[i]||[],e[i].push(t),e},{});if(0===Object.keys(n).length)return a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:en.slice(e),progress:{start:!0,done:!0}})),void $t.resetTile(e.id);const s={};for(const t in n)en.buildStyleGroup({group_name:t,groups:n,tile:e,progress:s,scene_id:i})}static async buildStyleGroup({group_name:e,groups:t,tile:i,progress:r,scene_id:n}){const s=t[e],o={};try{await Promise.all(s.map(async function(e){const t=await e.endData(i);t&&(o[e.name]=t)})),m("trace",`Finished style group '${e}' for tile ${i.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(r.done=!0),a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:Jr(Jr({},en.slice(i)),{},{mesh_data:o}),progress:r})),r.done&&$t.resetTile(i.id)}catch(t){m("error",`Error for style group '${e}' for tile ${i.key}`,t&&t.stack||t)}}static getDataForSource(e,t,i){var r=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&m({level:"warn",once:!0},`Layer ${i} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)r.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?r.push({geom:e.layers._default}):!t.layer&&i?r.push({layer:i,geom:e.layers[i]}):"string"==typeof t.layer?r.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{r.push({layer:t,geom:e.layers[t]})});return r}buildMeshes(e,t){if(this.error)return;this.build_id=Qr++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let i={},r=this.mesh_data;if(r)for(let t in r){for(let n in r[t].meshes){let s=r[t].meshes[n];if(s.vertex_data){if(!e[t]){m("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let n=Object.assign({},r[t]);n.uniforms=Object.assign({},n.uniforms,s.uniforms),n.variant=s.variant,s.labels&&(n.retain=!0);let o=e[t].makeMesh(s.vertex_data,s.vertex_elements,n);o.variant=n.variant,o.labels=s.labels,i[t]=i[t]||[],i[t].push(o),null==o.variant.mesh_order&&(o.variant.mesh_order=i[t].length-1),this.debug.buffer_size+=o.buffer_size,this.debug.geometry_count+=o.geometry_count}}i[t]&&i[t].sort((e,t)=>{let i=e.variant.mesh_order,r=t.variant.mesh_order;return null==i?1:null==r||i<r?-1:1})}delete this.mesh_data;for(let t in i)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=i[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=i[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(T.removeForTile(e.id),$t.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let i=e.mesh_data[t].textures;i&&i.forEach(t=>{let i=S.textures[t];i&&(m("trace",`releasing texture ${t} for tile ${e.key}`),i.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},i){i.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),i.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),rr.identity(e),rr.translate(e,e,tr.fromValues(this.min.x,this.min.y,0)),rr.scale(e,e,tr.fromValues(this.span.x/V.tile_scale,this.span.y/V.tile_scale,1)),rr.copy(t,e),i.uniform("Matrix4fv","u_model",t),i.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let i=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&i.push(...t);var r={};for(let t=0;t<i.length;t++){const n=i[t];r[n]=e[n]}return r}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=G(this.debug,e.debug),this}printDebug(e){const t=["layers"];let i={};for(let e in this.debug)-1===t.indexOf(e)&&(i[e]=this.debug[e]);m("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(i)} ]`)}}function tn(e,t){for(let i in e){let r=e[i];Oe(t,i,r.features,r.geoms,r.styles,r.base),r.layers&&(t[i].layers=t[i].layers||{},tn(r.layers,t[i].layers))}}en.coord_children={};var rn,nn,sn,on={};var an,ln,un,hn,cn,dn,fn,pn,_n,mn=function(){if(sn)return nn;sn=1,nn=t;var e=(rn||(rn=1,on.read=function(e,t,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=i?n-1:0,d=i?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)},on.write=function(e,t,i,r,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,p=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[i+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[i+f]=255&o,f+=p,o/=256,u-=8);e[i+f-p]|=128*_}),on);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i;function n(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function o(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function a(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function l(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function u(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function h(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function c(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function d(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function f(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function _(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function m(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function g(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,s=this.pos;this.type=7&r,e(n,t,this),this.pos===s&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=m(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=m(this.buf,this.pos)+m(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,i){for(var r="",n=t;n<i;){var s,o,a,l=e[n],u=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(u=l):2===h?128==(192&(s=e[n+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===h?(s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&((u=(15&l)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(s=e[n+1],o=e[n+2],a=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=h}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var i=n(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=n(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var i=7&e;if(i===t.Varint)for(;this.buf[this.pos++]>127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,s=0;s<t.length;s++){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){r>56319||s+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&o(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&o(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,c,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,_,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},nn}(),gn=O(mn),yn={};function bn(){if(hn)return un;hn=1;var e=function(){if(ln)return an;function e(e,t){this.x=e,this.y=t}return ln=1,an=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),s=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},an}();function t(e,t,r,n,s){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=s,e.readFields(i,this,t)}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function r(e){for(var t,i,r=0,n=0,s=e.length,o=s-1;n<s;o=n++)t=e[n],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}return un=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var i,r=t.readVarint()+t.pos,n=1,s=0,o=0,a=0,l=[];t.pos<r;){if(!s){var u=t.readVarint();n=7&u,s=u>>3}if(s--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(o,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var h=e.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<o&&(o=n),n>a&&(a=n),(s+=e.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,u]},t.prototype.toGeoJSON=function(e,i,n){var s,o,a=this.extent*Math.pow(2,n),l=this.extent*e,u=this.extent*i,h=this.loadGeometry(),c=t.types[this.type];function d(e){for(var t=0;t<e.length;t++){var i=e[t],r=180-360*(i.y+u)/a;e[t]=[360*(i.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(s=0;s<h.length;s++)f[s]=h[s][0];d(h=f);break;case 2:for(s=0;s<h.length;s++)d(h[s]);break;case 3:for(h=function(e){var t=e.length;if(t<=1)return[e];for(var i,n,s=[],o=0;o<t;o++){var a=r(e[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&s.push(i),i=[e[o]]):i.push(e[o]))}return i&&s.push(i),s}(h),s=0;s<h.length;s++)for(o=0;o<h[s].length;o++)d(h[s][o])}1===h.length?h=h[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:h},properties:this.properties};return"id"in this&&(p.id=this.id),p},un}function vn(){if(dn)return cn;dn=1;var e=bn();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(i,this,t),this.length=this._features.length}function i(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return cn=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},cn}var xn=(_n||(_n=1,yn.VectorTile=function(){if(pn)return fn;pn=1;var e=vn();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return fn=function(e,i){this.layers=e.readFields(t,{},i)},fn}(),yn.VectorTileFeature=bn(),yn.VectorTileLayer=vn()),yn);const wn=["{","["];class An extends ke{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&m({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,i){var r=new Uint8Array(i),n=new gn(r);if(t.data=new xn.VectorTile(n),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const i={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,i)}delete t.data}toGeoJSON(e){var t={};for(var i in e.layers){for(var r=e.layers[i],n=V.tile_scale/r.extent,s={type:"FeatureCollection",features:[]},o=0;o<r.length;o++){var a=r.feature(o),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,h=a.loadGeometry(),c=0;c<h.length;c++)for(var d=h[c],f=0;f<d.length;f++)d[f]=[d[f].x*n,d[f].y*n];u.coordinates=h,"Point"===xn.VectorTileFeature.types[a.type]?1===h.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xn.VectorTileFeature.types[a.type]?1===h.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xn.VectorTileFeature.types[a.type]&&(u=Tn(u)),s.features.push(l)}t[i]=s}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const i in t)if(wn.indexOf(t[i][0])>-1)try{t[i]=JSON.parse(t[i])}catch(e){}}}}function Tn(e){let t,i=[],r=[];for(let n=0;n<e.coordinates.length;n++){let s=e.coordinates[n],o=V.ringWinding(s);null!=o&&(t=t||o,o===t&&r.length>0&&(i.push(r),r=[]),r.push(s))}return r.length>0&&i.push(r),1===i.length?(e.type="Polygon",e.coordinates=i[0]):i.length>1?(e.type="MultiPolygon",e.coordinates=i):e=null,e}function kn(e,t,i,r){for(var n,s=r,o=i-t>>1,a=i-t,l=e[t],u=e[t+1],h=e[i],c=e[i+1],d=t+3;d<i;d+=3){var f=En(e[d],e[d+1],l,u,h,c);if(f>s)n=d,s=f;else if(f===s){var p=Math.abs(d-o);p<a&&(n=d,a=p)}}s>r&&(n-t>3&&kn(e,t,n,r),e[n+2]=s,i-n>3&&kn(e,n,i,r))}function En(e,t,i,r,n,s){var o=n-i,a=s-r;if(0!==o||0!==a){var l=((e-i)*o+(t-r)*a)/(o*o+a*a);l>1?(i=n,r=s):l>0&&(i+=o*l,r+=a*l)}return(o=e-i)*o+(a=t-r)*a}function Sn(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)Rn(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)Rn(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)Rn(e,t[r][n])}(n),n}function Rn(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function zn(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,s=t.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===s)Mn(n,a);else if("MultiPoint"===s)for(var u=0;u<n.length;u++)Mn(n[u],a);else if("LineString"===s)Pn(n,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<n.length;u++)a=[],Pn(n[u],a,o,!1),e.push(Sn(l,"LineString",a,t.properties));return}On(n,a,o,!1)}else if("Polygon"===s)On(n,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<t.geometry.geometries.length;u++)zn(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var h=[];On(n[u],h,o,!0),a.push(h)}}e.push(Sn(l,s,a,t.properties))}}function Mn(e,t){t.push(Nn(e[0])),t.push(Cn(e[1])),t.push(0)}function Pn(e,t,i,r){for(var n,s,o=0,a=0;a<e.length;a++){var l=Nn(e[a][0]),u=Cn(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(o+=r?(n*u-l*s)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-s,2))),n=l,s=u}var h=t.length-3;t[2]=1,kn(t,0,h,i),t[h+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function On(e,t,i,r){for(var n=0;n<e.length;n++){var s=[];Pn(e[n],s,i,r),t.push(s)}}function Nn(e){return e/360+.5}function Cn(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function Ln(e,t,i,r,n,s,o,a){if(r/=t,s>=(i/=t)&&o<r)return e;if(o<i||s>=r)return null;for(var l=[],u=0;u<e.length;u++){var h=e[u],c=h.geometry,d=h.type,f=0===n?h.minX:h.minY,p=0===n?h.maxX:h.maxY;if(f>=i&&p<r)l.push(h);else if(!(p<i||f>=r)){var _=[];if("Point"===d||"MultiPoint"===d)In(c,_,i,r,n);else if("LineString"===d)Fn(c,_,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===d)Un(c,_,i,r,n,!1);else if("Polygon"===d)Un(c,_,i,r,n,!0);else if("MultiPolygon"===d)for(var m=0;m<c.length;m++){var g=[];Un(c[m],g,i,r,n,!0),g.length&&_.push(g)}if(_.length){if(a.lineMetrics&&"LineString"===d){for(m=0;m<_.length;m++)l.push(Sn(h.id,d,_[m],h.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===_.length?(d="LineString",_=_[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===_.length?"Point":"MultiPoint"),l.push(Sn(h.id,d,_,h.tags))}}}return l.length?l:null}function In(e,t,i,r,n){for(var s=0;s<e.length;s+=3){var o=e[s+n];o>=i&&o<=r&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function Fn(e,t,i,r,n,s,o){for(var a,l,u=Dn(e),h=0===n?Bn:Gn,c=e.start,d=0;d<e.length-3;d+=3){var f=e[d],p=e[d+1],_=e[d+2],m=e[d+3],g=e[d+4],y=0===n?f:p,b=0===n?m:g,v=!1;o&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(p-g,2))),y<i?b>i&&(l=h(u,f,p,m,g,i),o&&(u.start=c+a*l)):y>r?b<r&&(l=h(u,f,p,m,g,r),o&&(u.start=c+a*l)):jn(u,f,p,_),b<i&&y>=i&&(l=h(u,f,p,m,g,i),v=!0),b>r&&y<=r&&(l=h(u,f,p,m,g,r),v=!0),!s&&v&&(o&&(u.end=c+a*l),t.push(u),u=Dn(e)),o&&(c+=a)}var x=e.length-3;f=e[x],p=e[x+1],_=e[x+2],(y=0===n?f:p)>=i&&y<=r&&jn(u,f,p,_),x=u.length-3,s&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&jn(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Dn(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Un(e,t,i,r,n,s){for(var o=0;o<e.length;o++)Fn(e[o],t,i,r,n,s,!1)}function jn(e,t,i,r){e.push(t),e.push(i),e.push(r)}function Bn(e,t,i,r,n,s){var o=(s-t)/(r-t);return e.push(s),e.push(i+(n-i)*o),e.push(1),o}function Gn(e,t,i,r,n,s){var o=(s-i)/(n-i);return e.push(t+(r-t)*o),e.push(s),e.push(1),o}function Vn(e,t){for(var i=[],r=0;r<e.length;r++){var n,s=e[r],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=$n(s.geometry,t);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var a=0;a<s.geometry.length;a++)n.push($n(s.geometry[a],t))}else if("MultiPolygon"===o)for(n=[],a=0;a<s.geometry.length;a++){for(var l=[],u=0;u<s.geometry[a].length;u++)l.push($n(s.geometry[a][u],t));n.push(l)}i.push(Sn(s.id,o,n,s.tags))}return i}function $n(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function qn(e,t){if(e.transformed)return e;var i,r,n,s=1<<e.z,o=e.x,a=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<u.length;r+=2)l.geometry.push(Wn(u[r],u[r+1],t,s,o,a));else for(r=0;r<u.length;r++){var c=[];for(n=0;n<u[r].length;n+=2)c.push(Wn(u[r][n],u[r][n+1],t,s,o,a));l.geometry.push(c)}}return e.transformed=!0,e}function Wn(e,t,i,r,n,s){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-s))]}function Zn(e,t,i,r,n){for(var s=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){o.numFeatures++,Hn(o,e[a],s,n);var l=e[a].minX,u=e[a].minY,h=e[a].maxX,c=e[a].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),h>o.maxX&&(o.maxX=h),c>o.maxY&&(o.maxY=c)}return o}function Hn(e,t,i,r){var n=t.geometry,s=t.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<n.length;a+=3)o.push(n[a]),o.push(n[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Xn(o,n,e,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<n.length;a++)Xn(o,n[a],e,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<n.length;l++){var u=n[l];for(a=0;a<u.length;a++)Xn(o,u[a],e,i,!0,0===a)}if(o.length){var h=t.tags||null;if("LineString"===s&&r.lineMetrics){for(var c in h={},t.tags)h[c]=t.tags[c];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var d={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:h};null!==t.id&&(d.id=t.id),e.features.push(d)}}function Xn(e,t,i,r,n,s){var o=r*r;if(r>0&&t.size<(n?o:r))i.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(i.numSimplified++,a.push(t[l]),a.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,s=n-2;r<n;s=r,r+=2)i+=(e[r]-e[s])*(e[r+1]+e[s+1]);if(i>0===t)for(r=0,n=e.length;r<n/2;r+=2){var o=e[r],a=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=o,e[n-1-r]=a}}(a,s),e.push(a)}}function Yn(e,t){return new Jn(e,t)}function Jn(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)zn(i,e.features[r],t,r);else"Feature"===e.type?zn(i,e,t):zn(i,{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var i=t.buffer/t.extent,r=e,n=Ln(e,1,-1-i,i,0,-1,2,t),s=Ln(e,1,1-i,2+i,0,-1,2,t);return(n||s)&&(r=Ln(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=Vn(n,1).concat(r)),s&&(r=r.concat(Vn(s,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.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 Kn(e,t,i){return 32*((1<<e)*i+t)+e}we.register("MVT",()=>An),Jn.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Jn.prototype.splitTile=function(e,t,i,r,n,s,o){for(var a=[e,t,i,r],l=this.options,u=l.debug;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();var h=1<<t,c=Kn(t,i,r),d=this.tiles[c];if(!d&&(u>1&&console.time("creation"),d=this.tiles[c]=Zn(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=e,n){if(t===l.maxZoom||t===n)continue;var p=1<<n-t;if(i!==Math.floor(s/p)||r!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){u>1&&console.time("clipping");var _,m,g,y,b,v,x=.5*l.buffer/l.extent,w=.5-x,A=.5+x,T=1+x;_=m=g=y=null,b=Ln(e,h,i-x,i+A,0,d.minX,d.maxX,l),v=Ln(e,h,i+w,i+T,0,d.minX,d.maxX,l),e=null,b&&(_=Ln(b,h,r-x,r+A,1,d.minY,d.maxY,l),m=Ln(b,h,r+w,r+T,1,d.minY,d.maxY,l),b=null),v&&(g=Ln(v,h,r-x,r+A,1,d.minY,d.maxY,l),y=Ln(v,h,r+w,r+T,1,d.minY,d.maxY,l),v=null),u>1&&console.timeEnd("clipping"),a.push(_||[],t+1,2*i,2*r),a.push(m||[],t+1,2*i,2*r+1),a.push(g||[],t+1,2*i+1,2*r),a.push(y||[],t+1,2*i+1,2*r+1)}}},Jn.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,s=r.debug;if(e<0||e>24)return null;var o=1<<e,a=Kn(e,t=(t%o+o)%o,i);if(this.tiles[a])return qn(this.tiles[a],n);s>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,h=t,c=i;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[Kn(u,h,c)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,h,c),s>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?qn(this.tiles[a],n):null):null};class Qn extends Te{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&m("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Yn(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:V.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let i,r=V.wrapTile(e.coords,{x:!0}),n=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(n&&n.features){i={type:"FeatureCollection",features:[]};for(let e=0;e<n.features.length;e++){const t=n.features[e];let r={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)r.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),r.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(r.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)r.geometry.type="MultiLineString";else if(r.geometry=Tn(r.geometry),null==r.geometry)continue}i.features.push(r)}}return i}formatURL(){return this.url}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i,n=this.getLayers(r);t.layers=this.preprocessLayers(n,e)}preprocessLayers(e,t){for(let t in e){let i=e[t];i.features=this.preprocessFeatures(i.features)}if("function"==typeof this.transform){const i={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,i):e=this.transform(e,this.extra_data,i)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],i={label_placement:!0};e.forEach(e=>{let r,n;if("Polygon"===e.geometry.type)r=e.geometry.coordinates,n=ts(r,e.id,e.properties,i),t.push(n);else if("MultiPolygon"===e.geometry.type){r=e.geometry.coordinates;let s=-1/0,o=0;for(let e=0;e<r.length;e++){let t=V.polygonArea(r[e]);t>s&&(s=t,o=e)}n=ts(r[o],e.id,e.properties,i),t.push(n)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class es extends ke{constructor(e,t){super(e,t)}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;this.prepareGeoJSON(r,e,t)}prepareGeoJSON(e,t,i){if("function"==typeof this.transform){const i={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,i)}i.layers=Qn.prototype.getLayers(e);let r={coords:t.coords,min:V.metersForTile(V.wrapTile(t.coords,{x:!0}))};we.projectData(i),we.scaleData(i,r)}}function ts(e,t,i,r){let n=V.centroid(e);if(!n)return;let s={};return Object.assign(s,i,r),{type:"Feature",id:t,properties:s,geometry:{type:"Point",coordinates:n}}}function is(e){return e}function rs(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,s=function(e,t){var i=function(e){if(null==(t=e.transform))return is;var t,i,r,n=t.scale[0],s=t.scale[1],o=t.translate[0],a=t.translate[1];return function(e,t){return t||(i=r=0),e[0]=(i+=e[0])*n+o,e[1]=(r+=e[1])*s+a,e}}(e),r=e.arcs;function n(e,t){t.length&&t.pop();for(var n=r[e<0?~e:e],s=0,o=n.length;s<o;++s)t.push(i(n[s].slice(),s));e<0&&function(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}(t,o)}function s(e){return i(e.slice())}function o(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=o(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var i,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":i=s(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(s);break;case"LineString":i=o(t.arcs);break;case"MultiLineString":i=t.arcs.map(o);break;case"Polygon":i=l(t.arcs);break;case"MultiPolygon":i=t.arcs.map(l);break;default:return null}return{type:r,coordinates:i}}(t)}(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:s}:null==r?{type:"Feature",id:i,properties:n,geometry:s}:{type:"Feature",id:i,bbox:r,properties:n,geometry:s}}we.register("GeoJSON",e=>es.urlHasTilePattern(e.url)?es:Qn);class ns extends Qn{parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=this.toGeoJSON(r);let n=this.getLayers(r);super.preprocessLayers(n,e),t.layers=n}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=ss(e,e.objects[t])}else{let t={};for(let i in e.objects)t[i]=ss(e,e.objects[i]);e=t}return e}}function ss(e,t){let i=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return rs(e,t)})}:rs(e,t)}(e,t);return"Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),i}class os extends es{constructor(e,t){super(e,t)}parseSourceData(e,t,i){let r="string"==typeof i?JSON.parse(i):i;r=ns.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t)}}we.register("TopoJSON",e=>os.urlHasTilePattern(e.url)?os:ns),e.Collision=$t,e.DataSource=we,e.FeatureSelection=ce,e.FilterOptions=Wr,e.FontManager=ri,e.GLSL=R,e.Geo=V,e.Label=jt,e.LabelLineStraight=pr,e.LabelPoint=qt,e.Light=be,e.Material=me,e.OBB=Ut,e.ShaderProgram=U,e.Style=Pe,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(vt)),this.register(Object.create(ur)),this.register(Object.create(vr)),this.register(Object.create(xr))}init(){U.removeBlock("global"),U.removeBlock("setup"),U.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),U.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),U.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),U.defines.TANGRAM_EPSILON=1e-5,U.defines.TANGRAM_LAYER_DELTA=1/16384,U.defines.TANGRAM_TILE_SCALE=`vec3(${V.tile_scale}., ${V.tile_scale}., u_meters_per_pixel * ${V.tile_size}.)`,U.defines.TANGRAM_HEIGHT_SCALE=V.height_scale,U.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let i=this.styles[t];i.gl===e&&(m("trace",`StyleManager.destroy: destroying render style ${i.name}`),i.base&&this.remove(i.name),i.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,i])=>{i.forEach(i=>{const r=i.variant.blend_order;let n=t.findIndex(e=>e.blend_order===r);n=n>-1?n:t.push({blend_order:r,styles:[]})-1,-1===t[n].styles.indexOf(e)&&t[n].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let i=[];e.mix&&(Array.isArray(e.mix)?i.push(...e.mix):i.push(e.mix),i=i.map(e=>t[e]).filter(t=>t&&t!==e),i.forEach(t=>e.mixed[t.name]=!0)),i.push(e),e.animated=i.some(e=>e&&e.animated),e.texcoords=i.some(e=>e&&e.texcoords),e.base=i.map(e=>e.base).filter(e=>e).pop(),e.lighting=i.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=i.map(e=>e.texture).filter(e=>e).pop(),e.raster=i.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=i.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=i.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),i.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=i.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=i.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...i.map(e=>e.material).filter(e=>e));let r=i.map(e=>e.draw).filter(e=>e);return r.length>0&&(e.draw=G({},...r)),this.mixShaders(e,t,i),e}mixShaders(e,t,i){let r={},n=i.map(e=>e.shaders).filter(e=>e);if(r.defines=Object.assign({},...n.map(e=>e.defines).filter(e=>e)),r.attributes=Object.assign({},...n.map(e=>e.attributes).filter(e=>e)),r.uniforms={},r._uniforms=e.shaders&&e.shaders.uniforms||{},r._uniform_scopes={},i.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let i in e.shaders.uniforms)r._uniform_scopes[i]=e.name,Object.defineProperty(r.uniforms,i,{enumerable:!0,configurable:!0,get:function(){return void 0!==r._uniforms[i]?r._uniforms[i]:t[r._uniform_scopes[i]].shaders.uniforms!==r.uniforms?t[r._uniform_scopes[i]].shaders.uniforms[i]:void 0},set:function(e){r._uniforms[i]=e}})}),r.extensions=Object.keys(n.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let i=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(i)?e.shaders.block_scopes[t].push(...i.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let s={};return n.forEach(e=>{if(!e.blocks)return;r.blocks=r.blocks||{},r.block_scopes=r.block_scopes||{};let t={};for(let i in e.blocks){let n=e.blocks[i],o=e.block_scopes[i];r.blocks[i]=r.blocks[i]||[],r.block_scopes[i]=r.block_scopes[i]||[],n=Array.isArray(n)?n:[n],o=Array.isArray(o)?o:[o];for(let e=0;e<n.length;e++)s[o[e]]||(t[o[e]]=!0,r.blocks[i].push(n[e]),r.block_scopes[i].push(o[e]))}Object.assign(s,t)}),Object.assign(e.mixed,s),e.shaders=r,e}create(e,t,i={}){let r=G({},t);return r.name=e,r=this.mix(r,i),r.base&&this.base_styles[r.base]?this.styles[e]=r=Object.assign(Object.create(this.base_styles[r.base]),r):r.base=null,r}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?wr(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):wr(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const i=["opaque","add","multiply","overlay","inlay","translucent"],r=["polygons","lines","points","text","raster"];for(const e of i)for(const i of r){const r=e+"_"+i;null==t[r]&&(t[r]={base:i,blend:e})}let s=Object.keys(t).sort((e,i)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(i,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let o={};return s.forEach(e=>{o[e]=this.create(e,t[e],o)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let i=0;for(;;){let r=t[e];if(!r)break;if(!r.mix)break;if(i++,Array.isArray(r.mix)){i+=Math.max(...r.mix.map(i=>{if(e!==i)return this.inheritanceDepth(i,t)}));break}if(e===r.mix)break;e=r.mix}return i}},e.StyleParser=Q,e.Task=T,e.TextCanvas=wi,e.Texture=S,e.Thread=t,e.Tile=en,e.TileID=Ee,e.Utils=g,e.Vector=ye,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=Le,e.View=class{constructor(e,t){k(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=nr.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*g.device_pixel_ratio),height:Math.round(this.size.css.height*g.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:i}={}){var r=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(r=!0,this.center={lng:e,lat:t})),"number"==typeof i&&i!==this.zoom&&(r=!0,this.setZoom(i)),r&&this.updateBounds(),r}setZoom(e){let t=this.tile_zoom,i=this.baseZoom(e);this.continuous_zoom||(e=i),i!==t&&(this.zoom_direction=i>t?1:-1),this.zoom=e,this.tile_zoom=i,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=V.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=V.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=V.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=V.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),i=V.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,i.x+this.buffer,i.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;r=r.map(e=>Math.min(Math.max(0,e),t))}let n=[];for(let t=r[0];t<=r[1];t++)for(let i=r[2];i<=r[3];i++)n.push(Ee.coord({x:t,y:i,z:e}));return n}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*V.tile_size,i=Ee.coordAtZoom(V.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),r=Ee.coordAtZoom(V.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<i.x||e.coords.x>r.x||e.coords.y<i.y||e.coords.y>r.y)&&(m("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${i.key}, ${r.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",g.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=n,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var i,r="/"!==e[0];if(t?(i=document.createElement("a")).href=t:i=window.location,r)e=v(i.href)+e;else{let t=i.origin;t||(t=i.protocol+"//"+i.host),e=t+e}return e},e.buildFilter=Dr,e.cache=Z,e.clearFunctionStringCache=function(){Z.functions={},Z.num_functions=0,Z.num_cached=0},e.compileFunctionStrings=H,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,m("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=b,e.debugSumLayerStats=function(e){let t={},i={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(i=>{let r=e.debug.layers.list[i];Oe(t,i,r.features,r.geoms,r.styles,r.base)}),tn(e.debug.layers.tree,i)}),{list:t,tree:i}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),i},e.getDefaultExportFromCjs=O,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Zr,e.layerCache=function(){return jr},e.log=m,e.mergeDebugSettings=function(e){Object.assign(y,e)},e.mergeObjects=G,e.parseLayers=function(e,t){jr={};let i={};for(let r in e){let n=e[r];n&&(i[r]=Hr(r,n,null,t))}return i},e.pathForURL=v,e.sliceObject=E,e.subscribeMixin=k,e.version=o}),r(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,i,r,n,s,o,a){return this.scene_id=t,this._worker_id=i,this.num_workers=r,e.log.setLevel(n),e.Utils.device_pixel_ratio=s,e.VertexElements.setElementIndexUint(o),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=i,e.Label.id_multiplier=r,i},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let i=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===i.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:i,introspection:r},n){return t=JSON.parse(t),e.mergeDebugSettings(n),this.generation=i,this.introspection=r,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let i=this.sources,r=[];this.sources={};for(let n in t.sources){if(JSON.stringify(this.last_config_sources[n])===JSON.stringify(t.sources[n])){this.sources[n]=i[n];continue}let s;t.sources[n]=e.compileFunctionStrings(t.sources[n]);try{s=e.DataSource.create(Object.assign({},t.sources[n],{name:n}),this.sources)}catch(e){continue}s&&(this.sources[n]=s,r.push(n))}r.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(i=>{t.loading=!1,t.loaded=!1,t.error=i.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(i){t.error=i.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const i in this.tiles){const r=this.tiles[i];if(r.source===e.source&&r.coords.key===e.coords.key&&r.loaded)return Promise.resolve(t.copyTileData(r,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var i=this.tiles[t];null!=i&&(!0===i.loading&&(e.log("trace",`cancel tile load for ${t}`),i.loading=!1,e.Tile.cancel(i)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:i,geometry:r,tile_keys:n}){let s=[],o=n.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),o.forEach(n=>{for(let o in n.source_data.layers){let a=n.source_data.layers[o];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===i&&!l||!1===i&&l)return;let u=e.StyleParser.getFeatureParseContext(a,n,this.global);if(u.source=n.source,u.layer=o,u.id=a.id,!t(u))return;let h={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===r&&(h.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(h.geometry,n.coords.z,n.min)),s.push(h)})}}),s},getFeatureSelection({id:t,key:i}={}){var r=e.FeatureSelection.map[i];return{id:t,feature:r&&r.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let i=[];return t&&i.push(...Object.keys(t)),e.log("trace","sync textures to worker:",i),i.length>0?e.Texture.syncTexturesToWorker(i):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),r(0,function(e){var t,r=t={};let n=0;function s(e,t){var i;const r=t[t.length-1];return null===(i=a(e,t))||void 0===i?void 0:i[r]}function o(e,t,i){const r=t[t.length-1],n=a(e,t);n&&(n[r]=i)}function a(e,t){if(0===t.length)return;let i=e;for(let e=0;e<t.length-1;e++)if(i=i[t[e]],null==i)return;return i}t.getContext=function(e,i){var r=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),r=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);if(!s)throw new Error("Couldn't create WebGL context.");return s._tangram_id=n++,r?(t.resize(s,window.innerWidth,window.innerHeight,i.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(s,window.innerWidth,window.innerHeight,i.device_pixel_ratio)})):t.resize(s,parseFloat(e.style.width),parseFloat(e.style.height),i.device_pixel_ratio),s},t.resize=function(e,t,i,r){r=r||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=i+"px",e.canvas.width=Math.round(t*r),e.canvas.height=Math.round(i*r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const l="global.",u="__global_prop";function h(e){return(null==e?void 0:e.slice(0,7))===l}function c(e,t){var i;const r=Array.isArray(t)?t:[t],n=a(e,r),s=r[r.length-1];return void 0!==(null==n||null===(i=n[u])||void 0===i?void 0:i[s])}function d(e,t=null,i={}){t=t?t+".":l;for(const r in e){const n=t+r,s=e[r];i[n]=s,"object"!=typeof s||Array.isArray(s)||d(s,n,i)}return i}function f(t,i,r,n){var s;let o;if(null!=r&&null!==(s=r[u])&&void 0!==s&&s[n]?o=r[u][n]:"string"==typeof i&&i.slice(0,7)===l&&(o=i),o){null==r[u]&&Object.defineProperty(r,u,{value:{}}),r[u][n]=o;let i,s=t[o];for(;"string"==typeof s&&s.slice(0,7)===l;){if(i=i||[o],i.indexOf(s)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",i),s=null;break}i.push(s),s=t[s]}Object.defineProperty(r,n,{enumerable:!0,get:function(){return s},set:function(e){delete r[u][n],delete r[n],r[n]=e}})}else if(Array.isArray(i))for(let e=0;e<i.length;e++)f(t,i[e],i,e);else if("object"==typeof i)for(const e in i)f(t,i[e],i,e);return i}var p="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_=[],m=[],g="undefined"!=typeof Uint8Array?Uint8Array:Array,y=!1;function b(){y=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)_[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,i){for(var r,n,s=[],o=t;o<i;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(_[(n=r)>>18&63]+_[n>>12&63]+_[n>>6&63]+_[63&n]);return s.join("")}function x(e){var t;y||b();for(var i=e.length,r=i%3,n="",s=[],o=16383,a=0,l=i-r;a<l;a+=o)s.push(v(e,a,a+o>l?l:a+o));return 1===r?(t=e[i-1],n+=_[t>>2],n+=_[t<<4&63],n+="=="):2===r&&(t=(e[i-2]<<8)+e[i-1],n+=_[t>>10],n+=_[t>>4&63],n+=_[t<<2&63],n+="="),s.push(n),s.join("")}function w(e,t,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=i?n-1:0,d=i?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)}function A(e,t,i,r,n,s){var o,a,l,u=8*s-n-1,h=(1<<u)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,p=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[i+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[i+f]=255&o,f+=p,o/=256,u-=8);e[i+f-p]|=128*_}var T={}.toString,k=Array.isArray||function(e){return"[object Array]"==T.call(e)};z.TYPED_ARRAY_SUPPORT=void 0===p.TYPED_ARRAY_SUPPORT||p.TYPED_ARRAY_SUPPORT;var E=S();function S(){return z.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(e,t){if(S()<t)throw new RangeError("Invalid typed array length");return z.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=z.prototype:(null===e&&(e=new z(t)),e.length=t),e}function z(e,t,i){if(!(z.TYPED_ARRAY_SUPPORT||this instanceof z))return new z(e,t,i);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return O(this,e)}return M(this,e,t,i)}function M(e,t,i,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,i,r){if(t.byteLength,i<0||t.byteLength<i)throw new RangeError("'offset' is out of bounds");if(t.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===i&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,i):new Uint8Array(t,i,r),z.TYPED_ARRAY_SUPPORT?(e=t).__proto__=z.prototype:e=N(e,t),e}(e,t,i,r):"string"==typeof t?function(e,t,i){if("string"==typeof i&&""!==i||(i="utf8"),!z.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|I(t,i),n=(e=R(e,r)).write(t,i);return n!==r&&(e=e.slice(0,n)),e}(e,t,i):function(e,t){if(L(t)){var i=0|C(t.length);return 0===(e=R(e,i)).length||t.copy(e,0,0,i),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?R(e,0):N(e,t);if("Buffer"===t.type&&k(t.data))return N(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function P(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function O(e,t){if(P(t),e=R(e,t<0?0:0|C(t)),!z.TYPED_ARRAY_SUPPORT)for(var i=0;i<t;++i)e[i]=0;return e}function N(e,t){var i=t.length<0?0:0|C(t.length);e=R(e,i);for(var r=0;r<i;r+=1)e[r]=255&t[r];return e}function C(e){if(e>=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function L(e){return!(null==e||!e._isBuffer)}function I(e,t){if(L(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return ue(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return he(e).length;default:if(r)return ue(e).length;t=(""+t).toLowerCase(),r=!0}}function F(e,t,i){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return K(this,t,i);case"utf8":case"utf-8":return H(this,t,i);case"ascii":return Y(this,t,i);case"latin1":case"binary":return J(this,t,i);case"base64":return Z(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,i);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function D(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function U(e,t,i,r,n){if(0===e.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(n)return-1;i=e.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof t&&(t=z.from(t,r)),L(t))return 0===t.length?-1:j(e,t,i,r,n);if("number"==typeof t)return t&=255,z.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):j(e,[t],i,r,n);throw new TypeError("val must be string, number or Buffer")}function j(e,t,i,r,n){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,i/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var h=-1;for(s=i;s<a;s++)if(u(e,s)===u(t,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===l)return h*o}else-1!==h&&(s-=s-h),h=-1}else for(i+l>a&&(i=a-l),s=i;s>=0;s--){for(var c=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){c=!1;break}if(c)return s}return-1}function B(e,t,i,r){i=Number(i)||0;var n=e.length-i;r?(r=Number(r))>n&&(r=n):r=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[i+o]=a}return o}function G(e,t,i,r){return ce(ue(t,e.length-i),e,i,r)}function V(e,t,i,r){return ce(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,r)}function $(e,t,i,r){return V(e,t,i,r)}function q(e,t,i,r){return ce(he(t),e,i,r)}function W(e,t,i,r){return ce(function(e,t){for(var i,r,n,s=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(i=e.charCodeAt(o))>>8,n=i%256,s.push(n),s.push(r);return s}(t,e.length-i),e,i,r)}function Z(e,t,i){return 0===t&&i===e.length?x(e):x(e.slice(t,i))}function H(e,t,i){i=Math.min(e.length,i);for(var r=[],n=t;n<i;){var s,o,a,l,u=e[n],h=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=i)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(s=e[n+1]))&&(l=(31&u)<<6|63&s)>127&&(h=l);break;case 3:s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:s=e[n+1],o=e[n+2],a=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),n+=c}return function(e){var t=e.length;if(t<=X)return String.fromCharCode.apply(String,e);for(var i="",r=0;r<t;)i+=String.fromCharCode.apply(String,e.slice(r,r+=X));return i}(r)}z.poolSize=8192,z._augment=function(e){return e.__proto__=z.prototype,e},z.from=function(e,t,i){return M(null,e,t,i)},z.TYPED_ARRAY_SUPPORT&&(z.prototype.__proto__=Uint8Array.prototype,z.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&z[Symbol.species]),z.alloc=function(e,t,i){return function(e,t,i,r){return P(t),t<=0?R(e,t):void 0!==i?"string"==typeof r?R(e,t).fill(i,r):R(e,t).fill(i):R(e,t)}(null,e,t,i)},z.allocUnsafe=function(e){return O(null,e)},z.allocUnsafeSlow=function(e){return O(null,e)},z.isBuffer=de,z.compare=function(e,t){if(!L(e)||!L(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,r=t.length,n=0,s=Math.min(i,r);n<s;++n)if(e[n]!==t[n]){i=e[n],r=t[n];break}return i<r?-1:r<i?1:0},z.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},z.concat=function(e,t){if(!k(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return z.alloc(0);var i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;var r=z.allocUnsafe(t),n=0;for(i=0;i<e.length;++i){var s=e[i];if(!L(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},z.byteLength=I,z.prototype._isBuffer=!0,z.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)D(this,t,t+1);return this},z.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)D(this,t,t+3),D(this,t+1,t+2);return this},z.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},z.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):F.apply(this,arguments)},z.prototype.equals=function(e){if(!L(e))throw new TypeError("Argument must be a Buffer");return this===e||0===z.compare(this,e)},z.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},z.prototype.compare=function(e,t,i,r,n){if(!L(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),t<0||i>e.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&t>=i)return 0;if(r>=n)return-1;if(t>=i)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(r,n),u=e.slice(t,i),h=0;h<a;++h)if(l[h]!==u[h]){s=l[h],o=u[h];break}return s<o?-1:o<s?1:0},z.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},z.prototype.indexOf=function(e,t,i){return U(this,e,t,i,!0)},z.prototype.lastIndexOf=function(e,t,i){return U(this,e,t,i,!1)},z.prototype.write=function(e,t,i,r){if(void 0===t)r="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)r=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-t;if((void 0===i||i>n)&&(i=n),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return B(this,e,t,i);case"utf8":case"utf-8":return G(this,e,t,i);case"ascii":return V(this,e,t,i);case"latin1":case"binary":return $(this,e,t,i);case"base64":return q(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;function Y(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(127&e[n]);return r}function J(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(e[n]);return r}function K(e,t,i){var r=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>r)&&(i=r);for(var n="",s=t;s<i;++s)n+=le(e[s]);return n}function Q(e,t,i){for(var r=e.slice(t,i),n="",s=0;s<r.length;s+=2)n+=String.fromCharCode(r[s]+256*r[s+1]);return n}function ee(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function te(e,t,i,r,n,s){if(!L(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(i+r>e.length)throw new RangeError("Index out of range")}function ie(e,t,i,r){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-i,2);n<s;++n)e[i+n]=(t&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function re(e,t,i,r){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-i,4);n<s;++n)e[i+n]=t>>>8*(r?n:3-n)&255}function ne(e,t,i,r,n,s){if(i+r>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function se(e,t,i,r,n){return n||ne(e,0,i,4),A(e,t,i,r,23,4),i+4}function oe(e,t,i,r,n){return n||ne(e,0,i,8),A(e,t,i,r,52,8),i+8}z.prototype.slice=function(e,t){var i,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),z.TYPED_ARRAY_SUPPORT)(i=this.subarray(e,t)).__proto__=z.prototype;else{var n=t-e;i=new z(n,void 0);for(var s=0;s<n;++s)i[s]=this[s+e]}return i},z.prototype.readUIntLE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e],n=1,s=0;++s<t&&(n*=256);)r+=this[e+s]*n;return r},z.prototype.readUIntBE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e+--t],n=1;t>0&&(n*=256);)r+=this[e+--t]*n;return r},z.prototype.readUInt8=function(e,t){return t||ee(e,1,this.length),this[e]},z.prototype.readUInt16LE=function(e,t){return t||ee(e,2,this.length),this[e]|this[e+1]<<8},z.prototype.readUInt16BE=function(e,t){return t||ee(e,2,this.length),this[e]<<8|this[e+1]},z.prototype.readUInt32LE=function(e,t){return t||ee(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},z.prototype.readUInt32BE=function(e,t){return t||ee(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},z.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=this[e],n=1,s=0;++s<t&&(n*=256);)r+=this[e+s]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*t)),r},z.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||ee(e,t,this.length);for(var r=t,n=1,s=this[e+--r];r>0&&(n*=256);)s+=this[e+--r]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},z.prototype.readInt8=function(e,t){return t||ee(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},z.prototype.readInt16LE=function(e,t){t||ee(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},z.prototype.readInt16BE=function(e,t){t||ee(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},z.prototype.readInt32LE=function(e,t){return t||ee(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},z.prototype.readInt32BE=function(e,t){return t||ee(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},z.prototype.readFloatLE=function(e,t){return t||ee(e,4,this.length),w(this,e,!0,23,4)},z.prototype.readFloatBE=function(e,t){return t||ee(e,4,this.length),w(this,e,!1,23,4)},z.prototype.readDoubleLE=function(e,t){return t||ee(e,8,this.length),w(this,e,!0,52,8)},z.prototype.readDoubleBE=function(e,t){return t||ee(e,8,this.length),w(this,e,!1,52,8)},z.prototype.writeUIntLE=function(e,t,i,r){e=+e,t|=0,i|=0,r||te(this,e,t,i,Math.pow(2,8*i)-1,0);var n=1,s=0;for(this[t]=255&e;++s<i&&(n*=256);)this[t+s]=e/n&255;return t+i},z.prototype.writeUIntBE=function(e,t,i,r){e=+e,t|=0,i|=0,r||te(this,e,t,i,Math.pow(2,8*i)-1,0);var n=i-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+i},z.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,1,255,0),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},z.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ie(this,e,t,!0),t+2},z.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ie(this,e,t,!1),t+2},z.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):re(this,e,t,!0),t+4},z.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},z.prototype.writeIntLE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);te(this,e,t,i,n-1,-n)}var s=0,o=1,a=0;for(this[t]=255&e;++s<i&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+i},z.prototype.writeIntBE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);te(this,e,t,i,n-1,-n)}var s=i-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+i},z.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,1,127,-128),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},z.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ie(this,e,t,!0),t+2},z.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ie(this,e,t,!1),t+2},z.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,2147483647,-2147483648),z.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):re(this,e,t,!0),t+4},z.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||te(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):re(this,e,t,!1),t+4},z.prototype.writeFloatLE=function(e,t,i){return se(this,e,t,!0,i)},z.prototype.writeFloatBE=function(e,t,i){return se(this,e,t,!1,i)},z.prototype.writeDoubleLE=function(e,t,i){return oe(this,e,t,!0,i)},z.prototype.writeDoubleBE=function(e,t,i){return oe(this,e,t,!1,i)},z.prototype.copy=function(e,t,i,r){if(i||(i=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-i&&(r=e.length-t+i);var n,s=r-i;if(this===e&&i<t&&t<r)for(n=s-1;n>=0;--n)e[n+t]=this[n+i];else if(s<1e3||!z.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)e[n+t]=this[n+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),t);return s},z.prototype.fill=function(e,t,i,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!z.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;var s;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(s=t;s<i;++s)this[s]=e;else{var o=L(e)?e:ue(new z(e,r).toString()),a=o.length;for(s=0;s<i-t;++s)this[s+t]=o[s%a]}return this};var ae=/[^+\/0-9A-Za-z-_]/g;function le(e){return e<16?"0"+e.toString(16):e.toString(16)}function ue(e,t){var i;t=t||1/0;for(var r=e.length,n=null,s=[],o=0;o<r;++o){if((i=e.charCodeAt(o))>55295&&i<57344){if(!n){if(i>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(t-=3)>-1&&s.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((t-=1)<0)break;s.push(i)}else if(i<2048){if((t-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function he(e){return function(e){var t,i,r,n,s,o;y||b();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new g(3*a/4-s),r=s>0?a-4:a;var l=0;for(t=0,i=0;t<r;t+=4,i+=3)n=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],o[l++]=n>>16&255,o[l++]=n>>8&255,o[l++]=255&n;return 2===s?(n=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,o[l++]=255&n):1===s&&(n=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,o[l++]=n>>8&255,o[l++]=255&n),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ae,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,i,r){for(var n=0;n<r&&!(n+i>=t.length||n>=e.length);++n)t[n+i]=e[n];return n}function de(e){return null!=e&&(!!e._isBuffer||fe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&fe(e.slice(0,0))}(e))}function fe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var pe=Object.freeze({__proto__:null,Buffer:z,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),z.alloc(+e)},isBuffer:de,kMaxLength:E});function _e(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var ge=_e,ye=me;function be(e){if(ge===setTimeout)return setTimeout(e,0);if((ge===_e||!ge)&&setTimeout)return ge=setTimeout,setTimeout(e,0);try{return ge(e,0)}catch(t){try{return ge.call(null,e,0)}catch(t){return ge.call(this,e,0)}}}"function"==typeof p.setTimeout&&(ge=setTimeout),"function"==typeof p.clearTimeout&&(ye=clearTimeout);var ve,xe=[],we=!1,Ae=-1;function Te(){we&&ve&&(we=!1,ve.length?xe=ve.concat(xe):Ae=-1,xe.length&&ke())}function ke(){if(!we){var e=be(Te);we=!0;for(var t=xe.length;t;){for(ve=xe,xe=[];++Ae<t;)ve&&ve[Ae].run();Ae=-1,t=xe.length}ve=null,we=!1,function(e){if(ye===clearTimeout)return clearTimeout(e);if((ye===me||!ye)&&clearTimeout)return ye=clearTimeout,clearTimeout(e);try{return ye(e)}catch(t){try{return ye.call(null,e)}catch(t){return ye.call(this,e)}}}(e)}}function Ee(e,t){this.fun=e,this.array=t}Ee.prototype.run=function(){this.fun.apply(null,this.array)};var Se=p.performance||{};function Re(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Se.now||Se.mozNow||Se.msNow||Se.oNow||Se.webkitNow;var ze,Me,Pe,Oe,Ne,Ce,Le,Ie,Fe,De,Ue,je,Be,Ge,Ve,$e,qe,We,Ze,He,Xe,Ye,Je,Ke,Qe,et,tt,it,rt,nt,st,ot,at,lt,ut={exports:{}},ht=(ze||(ze=1,ut.exports=function e(t,i,r){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&Re)return Re(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[o]={exports:{}};t[o][0].call(u.exports,function(e){return n(t[o][1][e]||e)},u,u.exports,e,t,i,r)}return i[o].exports}for(var s=Re,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,l,u,h=[],c=0,d=e.length,f=d,p="string"!==r.getTypeOf(e);c<e.length;)f=d-c,n=p?(t=e[c++],i=c<d?e[c++]:0,c<d?e[c++]:0):(t=e.charCodeAt(c++),i=c<d?e.charCodeAt(c++):0,c<d?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|i>>4,l=1<f?(15&i)<<2|n>>6:64,u=2<f?63&n:64,h.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(u));return h.join("")},i.decode=function(e){var t,i,r,o,a,l,u=0,h=0,c="data:";if(e.substr(0,5)===c)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=n.uint8array?new Uint8Array(0|f):new Array(0|f);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,i=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,r=(3&a)<<6|(l=s.indexOf(e.charAt(u++))),d[h++]=t,64!==a&&(d[h++]=i),64!==l&&(d[h++]=r);return d}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,s=0+i;e^=-1;for(var o=0;o<s;o++)e=e>>>8^r[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,i){var r=n,s=0+i;e^=-1;for(var o=0;o<s;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new l("Deflate",e)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,h){var c,d,f=e.file,p=e.compression,_=h!==a.utf8encode,m=s.transformTo("string",h(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,b=s.transformTo("string",h(y)),v=s.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,w=v.length!==y.length,A="",T="",k="",E=f.dir,S=f.date,R={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(R.crc32=e.crc32,R.compressedSize=e.compressedSize,R.uncompressedSize=e.uncompressedSize);var z=0;t&&(z|=8),_||!x&&!w||(z|=2048);var M=0,P=0;E&&(M|=16),"UNIX"===o?(P=798,M|=function(e,t){var i=e;return e||(i=t?16893:33204),(65535&i)<<16}(f.unixPermissions,E)):(P=20,M|=function(e){return 63&(e||0)}(f.dosPermissions)),c=S.getUTCHours(),c<<=6,c|=S.getUTCMinutes(),c<<=5,c|=S.getUTCSeconds()/2,d=S.getUTCFullYear()-1980,d<<=4,d|=S.getUTCMonth()+1,d<<=5,d|=S.getUTCDate(),x&&(T=r(1,1)+r(l(m),4)+g,A+="up"+r(T.length,2)+T),w&&(k=r(1,1)+r(l(b),4)+v,A+="uc"+r(k.length,2)+k);var O="";return O+="\n\0",O+=r(z,2),O+=p.magic,O+=r(c,2),O+=r(d,2),O+=r(R.crc32,4),O+=r(R.compressedSize,4),O+=r(R.uncompressedSize,4),O+=r(m.length,2),O+=r(A.length,2),{fileRecord:u.LOCAL_FILE_HEADER+O+m+A,dirRecord:u.CENTRAL_FILE_HEADER+r(P,2)+O+r(b.length,2)+"\0\0\0\0"+r(M,4)+r(n,4)+m+A+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function h(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,n=function(e,t,i,n,o){var a=s.transformTo("string",o(n));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(i,4)+r(a.length,2)+a}(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var s=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},l=i.dir,u=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new n.Promise(function(t,i){var r=e.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){i(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),l.isNode&&l.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var i=new o(t);return i.load(e),i}).then(function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var s=0;s<r.length;s++)i.push(u(r[s]));return n.Promise.all(i)}).then(function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],l=a.fileNameStr,u=r.resolve(a.fileNameStr);i.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(u).unsafeOriginalName=l)}return n.zipComment.length&&(i.comment=n.zipComment),i})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(s,n),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),i&&i(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:void 0!==z,newBufferFrom:function(e,t){if(z.from&&z.from!==Uint8Array.from)return z.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new z(e,t)},allocBuffer:function(e){if(z.alloc)return z.alloc(e);var t=new z(e);return t.fill(0),t},isBuffer:function(e){return de(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=s.getTypeOf(t),a=s.extend(i||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=_(e)),a.createFolders&&(r=p(e))&&m.call(this,r,!0);var c="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!c),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var g;g=t instanceof u||t instanceof o?t:d.isNode&&d.isStream(t)?new f(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new h(e,g,a);this.files[e]=y}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),h=e("./zipObject"),c=e("./generate"),d=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},_=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},m=function(e,t){return t=void 0!==t?t:l.createFolders,e=_(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach(function(i,r){e(i,r)&&t.push(r)}),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(g(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(g(e))return this.filter(function(t,i){return i.dir&&e.test(t)});var t=this.root+e,i=m.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(t,i){return i.name.slice(0,e.length)===e}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");s.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=c.generateWorker(this,i,r)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===i&&this.data[s+2]===r&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&i===s[1]&&r===s[2]&&n===s[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new l(r.transformTo("uint8array",e)):new s(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function s(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(s,r),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,r),s.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}h.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(i,n){var s=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,i){s.push(e),t&&t(i)}).on("error",function(e){s=[],n(e)}).on("end",function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var i,r=0,n=null,s=0;for(i=0;i<t.length;i++)s+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(s),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return z.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);i(e)}catch(e){n(e)}s=[]}).resume()})}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,function(e){t.call(i,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,i)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer=void 0!==z,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,i,r,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(l):new Array(l),s=o=0;o<l;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,s,o=e.length,l=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)l[i++]=n;else if(4<(s=a[n]))l[i++]=65533,t+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),r.applyFromCharCode(l)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(u,o),u.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),l=t;o!==t.length&&(n.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,r.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,i){var r=[],n=0,s=e.length;if(s<=i)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,s)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,s)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=u.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=u.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return u.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function c(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var d={};d.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,s.allocBuffer(e.length))}},d.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},d.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},d.nodebuffer={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return d[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&s.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var h=i.getTypeOf(t);return h?("arraybuffer"===h?t=i.transformTo("uint8array",t):"string"===h&&(u?t=n.decode(t):s&&!0!==a&&(t=function(e){return l(e,r.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var s=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)r.prototype[u[c]]=h;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,i=function(){l.port2.postMessage(0)}}var u=[];function h(){var e,t;r=!0;for(var i=u.length;i;){for(t=u,u=[],e=-1;++e<i;)t[e]();i=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||i()}}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==n&&f(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function c(e,t,i){r(function(){var r;try{r=t(i)}catch(r){return s.reject(e,r)}r===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,r)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var i=!1;function r(t){i||(i=!0,s.reject(e,t))}function n(t){i||(i=!0,s.resolve(e,t))}var o=p(function(){t(n,r)});"error"===o.status&&r(o.value)}function p(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(i){return t.resolve(e()).then(function(){return i})},function(i){return t.resolve(e()).then(function(){throw i})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==l?c(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){s.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e)},s.resolve=function(e,t){var i=p(d,t);if("error"===i.status)return s.reject(e,i.value);var r=i.value;if(r)f(e,r);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},u.reject=function(e){var t=new this(n);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,l=-1,u=new this(n);++l<i;)h(e[l],l);return u;function h(e,n){t.resolve(e).then(function(e){o[n]=e,++a!==i||r||(r=!0,s.resolve(u,o))},function(e){r||(r=!0,s.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,i=!1;if(!t)return this.resolve([]);for(var r,o=-1,a=new this(n);++o<t;)r=e[o],this.resolve(r).then(function(e){i||(i=!0,s.resolve(a,e))},function(e){i||(i=!0,s.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var h;if(h="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,h)))throw new Error(o[i]);this._dict_set=!0}}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}u.prototype.push=function(e,t){var i,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(u),a.next_out=0,a.avail_out=u),1!==(i=r.deflate(a,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=u,i.deflate=h,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,h(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),h=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function d(e,t){var i=new c(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}c.prototype.push=function(e,t){var i,a,l,u,c,d,f=this.strm,p=this.options.chunkSize,_=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?f.input=s.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new n.Buf8(p),f.next_out=0,f.avail_out=p),(i=r.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&_&&(d="string"==typeof _?s.string2buf(_):"[object ArrayBuffer]"===h.call(_)?new Uint8Array(_):_,i=r.inflateSetDictionary(this.strm,d)),i===o.Z_BUF_ERROR&&!0===m&&(i=o.Z_OK,m=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&i!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(f.output,f.next_out),u=f.next_out-l,c=s.buf2string(f.output,l),f.next_out=u,f.avail_out=p-u,u&&n.arraySet(f.output,f.output,l,u,0),this.onData(c)):this.onData(n.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(m=!0)}while((0<f.avail_in||0===f.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=c,i.inflate=d,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var s=0;s<r;s++)e[n+s]=t[i+s]},flattenChunks:function(e){var t,i,r,n,s,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,i,r,n){for(var s=0;s<r;s++)e[n+s]=t[i+s]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,s))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,s,o,a=e.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(l),s=o=0;o<l;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return l(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,s,a=t||e.length,u=new Array(2*a);for(i=r=0;i<a;)if((n=e[i++])<128)u[r++]=n;else if(4<(s=o[n]))u[r++]=65533,i+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&i<a;)n=n<<6|63&e[i++],s--;1<s?u[r++]=65533:n<65536?u[r++]=n:(n-=65536,u[r++]=55296|n>>10&1023,u[r++]=56320|1023&n)}return l(u,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,s=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;s=s+(n=n+t[r++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16}},{}],44:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,i){var r=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var s=r,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,h=258,c=262,d=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4<e?9:0)}function _(e){for(var t=e.length;0<=--t;)e[t]=0}function m(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function g(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,m(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function v(e,t){var i,r,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-c?e.strstart-(e.w_size-c):0,u=e.window,d=e.w_mask,f=e.prev,p=e.strstart+h,_=u[s+o-1],m=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(i=t)+o]===m&&u[i+o-1]===_&&u[i]===u[s]&&u[++i]===u[s+1]){s+=2,i++;do{}while(u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&s<p);if(r=h-(p-s),s=p-h,o<r){if(e.match_start=t,a<=(o=r))break;_=u[s+o-1],m=u[s+o]}}}while((t=f[t&d])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function x(e){var t,i,r,s,l,u,h,d,f,p,_=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=_+(_-c)){for(n.arraySet(e.window,e.window,_,_,0),e.match_start-=_,e.strstart-=_,e.block_start-=_,t=i=e.hash_size;r=e.head[--t],e.head[t]=_<=r?r-_:0,--i;);for(t=i=_;r=e.prev[--t],e.prev[t]=_<=r?r-_:0,--i;);s+=_}if(0===e.strm.avail_in)break;if(u=e.strm,h=e.window,d=e.strstart+e.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),i=0===p?0:(u.avail_in-=p,n.arraySet(h,u.input,u.next_in,p,d),1===u.state.wrap?u.adler=o(u.adler,h,p,d):2===u.state.wrap&&(u.adler=a(u.adler,h,p,d)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=i,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<c&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<c){if(x(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-c&&(e.match_length=v(e,i)),e.match_length>=3)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function A(e,t){for(var i,r,n;;){if(e.lookahead<c){if(x(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-c&&(e.match_length=v(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(g(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=s._tr_tally(e,0,e.window[e.strstart-1]))&&g(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}function T(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function k(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),_(this.dyn_ltree),_(this.dyn_dtree),_(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),_(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),_(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:d,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):f(e,u)}function S(e){var t=E(e);return 0===t&&function(e){e.window_size=2*e.w_size,_(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function R(e,t,i,r,s,o){if(!e)return u;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),s<1||9<s||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return f(e,u);8===r&&(r=9);var l=new k;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new n.Buf8(2*l.w_size),l.head=new n.Buf16(l.hash_size),l.prev=new n.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new n.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=i,S(e)}r=[new T(0,0,0,0,function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-c&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)}),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,A),new T(8,16,32,32,A),new T(8,16,128,128,A),new T(8,32,128,256,A),new T(32,128,258,1024,A),new T(32,258,258,4096,A)],i.deflateInit=function(e,t){return R(e,t,8,15,8,0)},i.deflateInit2=R,i.deflateReset=S,i.deflateResetKeep=E,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},i.deflate=function(e,t){var i,n,o,l;if(!e||!e.state||5<t||t<0)return e?f(e,u):u;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return f(e,0===e.avail_out?-5:u);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,y(n,31),y(n,139),y(n,8),n.gzhead?(y(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),y(n,255&n.gzhead.time),y(n,n.gzhead.time>>8&255),y(n,n.gzhead.time>>16&255),y(n,n.gzhead.time>>24&255),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(y(n,255&n.gzhead.extra.length),y(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(y(n,0),y(n,0),y(n,0),y(n,0),y(n,0),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,3),n.status=d);else{var c=8+(n.w_bits-8<<4)<<8;c|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(c|=32),c+=31-c%31,n.status=d,b(n,c),0!==n.strstart&&(b(n,e.adler>>>16),b(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending!==n.pending_buf_size));)y(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,y(n,l)}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),m(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,y(n,l)}while(0!==l);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&m(e),n.pending+2<=n.pending_buf_size&&(y(n,255&e.adler),y(n,e.adler>>8&255),e.adler=0,n.status=d)):n.status=d),0!==n.pending){if(m(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(i)&&4!==t)return f(e,-5);if(666===n.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var v=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=h){if(x(e),e.lookahead<=h&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+h;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=h-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==v&&4!==v||(n.status=666),1===v||3===v)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===v&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(_(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),m(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(y(n,255&e.adler),y(n,e.adler>>8&255),y(n,e.adler>>16&255),y(n,e.adler>>24&255),y(n,255&e.total_in),y(n,e.total_in>>8&255),y(n,e.total_in>>16&255),y(n,e.total_in>>24&255)):(b(n,e.adler>>>16),b(n,65535&e.adler)),m(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==d&&666!==t?f(e,u):(e.state=null,t===d?f(e,-3):0):u},i.deflateSetDictionary=function(e,t){var i,r,s,a,l,h,c,d,f=t.length;if(!e||!e.state)return u;if(2===(a=(i=e.state).wrap)||1===a&&42!==i.status||i.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,f,0)),i.wrap=0,f>=i.w_size&&(0===a&&(_(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,f-i.w_size,i.w_size,0),t=d,f=i.w_size),l=e.avail_in,h=e.next_in,c=e.input,e.avail_in=f,e.next_in=0,e.input=t,x(i);i.lookahead>=3;){for(r=i.strstart,s=i.lookahead-2;i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--s;);i.strstart=r,i.lookahead=2,x(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=h,e.input=c,e.avail_in=l,i.wrap=a,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,s,o,a,l,u,h,c,d,f,p,_,m,g,y,b,v,x,w,A,T,k,E;i=e.state,r=e.next_in,k=e.input,n=r+(e.avail_in-5),s=e.next_out,E=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=i.dmax,u=i.wsize,h=i.whave,c=i.wnext,d=i.window,f=i.hold,p=i.bits,_=i.lencode,m=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{p<15&&(f+=k[r++]<<p,p+=8,f+=k[r++]<<p,p+=8),b=_[f&g];t:for(;;){if(f>>>=v=b>>>24,p-=v,0==(v=b>>>16&255))E[s++]=65535&b;else{if(!(16&v)){if(!(64&v)){b=_[(65535&b)+(f&(1<<v)-1)];continue t}if(32&v){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}x=65535&b,(v&=15)&&(p<v&&(f+=k[r++]<<p,p+=8),x+=f&(1<<v)-1,f>>>=v,p-=v),p<15&&(f+=k[r++]<<p,p+=8,f+=k[r++]<<p,p+=8),b=m[f&y];i:for(;;){if(f>>>=v=b>>>24,p-=v,!(16&(v=b>>>16&255))){if(!(64&v)){b=m[(65535&b)+(f&(1<<v)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&b,p<(v&=15)&&(f+=k[r++]<<p,(p+=8)<v&&(f+=k[r++]<<p,p+=8)),l<(w+=f&(1<<v)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(f>>>=v,p-=v,(v=s-o)<w){if(h<(v=w-v)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=d,(A=0)===c){if(A+=u-v,v<x){for(x-=v;E[s++]=d[A++],--v;);A=s-w,T=E}}else if(c<v){if(A+=u+c-v,(v-=c)<x){for(x-=v;E[s++]=d[A++],--v;);if(A=0,c<x){for(x-=v=c;E[s++]=d[A++],--v;);A=s-w,T=E}}}else if(A+=c-v,v<x){for(x-=v;E[s++]=d[A++],--v;);A=s-w,T=E}for(;2<x;)E[s++]=T[A++],E[s++]=T[A++],E[s++]=T[A++],x-=3;x&&(E[s++]=T[A++],1<x&&(E[s++]=T[A++]))}else{for(A=s-w;E[s++]=E[A++],E[s++]=E[A++],E[s++]=E[A++],2<(x-=3););x&&(E[s++]=E[A++],1<x&&(E[s++]=E[A++]))}break}}break}}while(r<n&&s<a);r-=x=p>>3,f&=(1<<(p-=x<<3))-1,e.next_in=r,e.next_out=s,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=s<a?a-s+257:257-(s-a),i.hold=f,i.bits=p}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):l}function d(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,c(e)):l}function f(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,d(e))):l}function p(e,t){var i,r;return e?(r=new h,(e.state=r).window=null,0!==(i=f(e,t))&&(e.state=null),i):l}var _,m,g=!0;function y(e){if(g){var t;for(_=new r.Buf32(512),m=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,_,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,m,0,e.work,{bits:5}),g=!1}e.lencode=_,e.lenbits=9,e.distcode=m,e.distbits=5}function b(e,t,i,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),r.arraySet(o.window,t,i-n,s,o.wnext),(n-=s)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}i.inflateReset=d,i.inflateReset2=f,i.inflateResetKeep=c,i.inflateInit=function(e){return p(e,15)},i.inflateInit2=p,i.inflate=function(e,t){var i,h,c,d,f,p,_,m,g,v,x,w,A,T,k,E,S,R,z,M,P,O,N,C,L=0,I=new r.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(i=e.state).mode&&(i.mode=13),f=e.next_out,c=e.output,_=e.avail_out,d=e.next_in,h=e.input,p=e.avail_in,m=i.hold,g=i.bits,v=p,x=_,O=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(2&i.wrap&&35615===m){I[i.check=0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0),g=m=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,P=8+(15&(m>>>=4)),0===i.wbits)i.wbits=P;else if(P>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<P,e.adler=i.check=1,i.mode=512&m?10:12,g=m=0;break;case 2:for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(i.flags=m,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=m>>8&1),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0,i.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.head&&(i.head.time=m),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,I[2]=m>>>16&255,I[3]=m>>>24&255,i.check=s(i.check,I,4,0)),g=m=0,i.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.head&&(i.head.xflags=255&m,i.head.os=m>>8),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.length=m,i.head&&(i.head.extra_len=m),512&i.flags&&(I[0]=255&m,I[1]=m>>>8&255,i.check=s(i.check,I,2,0)),g=m=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(p<(w=i.length)&&(w=p),w&&(i.head&&(P=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,h,d,w,P)),512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===p)break e;for(w=0;P=h[d+w++],i.head&&P&&i.length<65536&&(i.head.name+=String.fromCharCode(P)),P&&w<p;);if(512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,P)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===p)break e;for(w=0;P=h[d+w++],i.head&&P&&i.length<65536&&(i.head.comment+=String.fromCharCode(P)),P&&w<p;);if(512&i.flags&&(i.check=s(i.check,h,w,d)),p-=w,d+=w,P)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=m=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}e.adler=i.check=u(m),g=m=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){m>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}switch(i.last=1&m,g-=1,3&(m>>>=1)){case 0:i.mode=14;break;case 1:if(y(i),i.mode=20,6!==t)break;m>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}m>>>=2,g-=2;break;case 14:for(m>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if((65535&m)!=(m>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&m,g=m=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(p<w&&(w=p),_<w&&(w=_),0===w)break e;r.arraySet(c,h,d,w,f),p-=w,d+=w,_-=w,f+=w,i.length-=w;break}i.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(i.nlen=257+(31&m),m>>>=5,g-=5,i.ndist=1+(31&m),m>>>=5,g-=5,i.ncode=4+(15&m),m>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.lens[F[i.have++]]=7&m,m>>>=3,g-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},O=a(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,O){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;E=(L=i.lencode[m&(1<<i.lenbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(S<16)m>>>=k,g-=k,i.lens[i.have++]=S;else{if(16===S){for(C=k+2;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m>>>=k,g-=k,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}P=i.lens[i.have-1],w=3+(3&m),m>>>=2,g-=2}else if(17===S){for(C=k+3;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}g-=k,P=0,w=3+(7&(m>>>=k)),m>>>=3,g-=3}else{for(C=k+7;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}g-=k,P=0,w=11+(127&(m>>>=k)),m>>>=7,g-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=P}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,N={bits:i.lenbits},O=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,O){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},O=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,O){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=p&&258<=_){e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,o(e,x),f=e.next_out,c=e.output,_=e.avail_out,d=e.next_in,h=e.input,p=e.avail_in,m=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;E=(L=i.lencode[m&(1<<i.lenbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(E&&!(240&E)){for(R=k,z=E,M=S;E=(L=i.lencode[M+((m&(1<<R+z)-1)>>R)])>>>16&255,S=65535&L,!(R+(k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}m>>>=R,g-=R,i.back+=R}if(m>>>=k,g-=k,i.back+=k,i.length=S,0===E){i.mode=26;break}if(32&E){i.back=-1,i.mode=12;break}if(64&E){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&E,i.mode=22;case 22:if(i.extra){for(C=i.extra;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.length+=m&(1<<i.extra)-1,m>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;E=(L=i.distcode[m&(1<<i.distbits)-1])>>>16&255,S=65535&L,!((k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(!(240&E)){for(R=k,z=E,M=S;E=(L=i.distcode[M+((m&(1<<R+z)-1)>>R)])>>>16&255,S=65535&L,!(R+(k=L>>>24)<=g);){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}m>>>=R,g-=R,i.back+=R}if(m>>>=k,g-=k,i.back+=k,64&E){e.msg="invalid distance code",i.mode=30;break}i.offset=S,i.extra=15&E,i.mode=24;case 24:if(i.extra){for(C=i.extra;g<C;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}i.offset+=m&(1<<i.extra)-1,m>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===_)break e;if(w=x-_,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}A=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=c,A=f-i.offset,w=i.length;for(_<w&&(w=_),_-=w,i.length-=w;c[f++]=T[A++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===_)break e;c[f++]=i.length,_--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===p)break e;p--,m|=h[d++]<<g,g+=8}if(x-=_,e.total_out+=x,i.total+=x,x&&(e.adler=i.check=i.flags?s(i.check,c,x,f-x):n(i.check,c,x,f-x)),x=_,(i.flags?m:u(m))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=m=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===p)break e;p--,m+=h[d++]<<g,g+=8}if(m!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=m=0}i.mode=29;case 29:O=1;break e;case 30:O=-3;break e;case 31:return-4;default:return l}return e.next_out=f,e.avail_out=_,e.next_in=d,e.avail_in=p,i.hold=m,i.bits=g,(i.wsize||x!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&b(e,e.output,e.next_out,x-e.avail_out)?(i.mode=31,-4):(v-=e.avail_in,x-=e.avail_out,e.total_in+=v,e.total_out+=x,i.total+=x,i.wrap&&x&&(e.adler=i.check=i.flags?s(i.check,c,x,e.next_out-x):n(i.check,c,x,e.next_out-x)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==v&&0===x||4===t)&&0===O&&(O=-5),O)},i.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):l},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?l:11===i.mode&&n(1,t,r,0)!==i.check?-3:b(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):l},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,l,u,h,c,d){var f,p,_,m,g,y,b,v,x,w=d.bits,A=0,T=0,k=0,E=0,S=0,R=0,z=0,M=0,P=0,O=0,N=null,C=0,L=new r.Buf16(16),I=new r.Buf16(16),F=null,D=0;for(A=0;A<=15;A++)L[A]=0;for(T=0;T<l;T++)L[t[i+T]]++;for(S=w,E=15;1<=E&&0===L[E];E--);if(E<S&&(S=E),0===E)return u[h++]=20971520,u[h++]=20971520,d.bits=1,0;for(k=1;k<E&&0===L[k];k++);for(S<k&&(S=k),A=M=1;A<=15;A++)if(M<<=1,(M-=L[A])<0)return-1;if(0<M&&(0===e||1!==E))return-1;for(I[1]=0,A=1;A<15;A++)I[A+1]=I[A]+L[A];for(T=0;T<l;T++)0!==t[i+T]&&(c[I[t[i+T]]++]=T);if(y=0===e?(N=F=c,19):1===e?(N=n,C-=257,F=s,D-=257,256):(N=o,F=a,-1),A=k,g=h,z=T=O=0,_=-1,m=(P=1<<(R=S))-1,1===e&&852<P||2===e&&592<P)return 1;for(;;){for(b=A-z,x=c[T]<y?(v=0,c[T]):c[T]>y?(v=F[D+c[T]],N[C+c[T]]):(v=96,0),f=1<<A-z,k=p=1<<R;u[g+(O>>z)+(p-=f)]=b<<24|v<<16|x,0!==p;);for(f=1<<A-1;O&f;)f>>=1;if(0!==f?(O&=f-1,O+=f):O=0,T++,0==--L[A]){if(A===E)break;A=t[i+c[T]]}if(S<A&&(O&m)!==_){for(0===z&&(z=S),g+=k,M=1<<(R=A-z);R+z<E&&!((M-=L[R+z])<=0);)R++,M<<=1;if(P+=1<<R,1===e&&852<P||2===e&&592<P)return 1;u[_=O&m]=S<<24|R<<16|g-h}}return 0!==O&&(u[g+O]=A-z<<24|64<<16),d.bits=S,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],h=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);n(f);var p=new Array(60);n(p);var _=new Array(512);n(_);var m=new Array(256);n(m);var g=new Array(29);n(g);var y,b,v,x=new Array(a);function w(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?_[e]:_[256+(e>>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,k(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function S(e,t,i){E(e,i[2*t],i[2*t+1])}function R(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function z(e,t,i){var r,n,s=new Array(16),o=0;for(r=1;r<=l;r++)s[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=R(s[a]++,a))}}function M(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function P(e){8<e.bi_valid?k(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function O(e,t,i,r){var n=2*t,s=2*i;return e[n]<e[s]||e[n]===e[s]&&r[t]<=r[i]}function N(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&O(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!O(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function C(e,t,i){var r,n,o,a,l=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],n=e.pending_buf[e.l_buf+l],l++,0===r?S(e,n,t):(S(e,(o=m[n])+s+1,t),0!==(a=u[o])&&E(e,n-=g[o],a),S(e,o=T(--r),i),0!==(a=h[o])&&E(e,r-=x[o],a)),l<e.last_lit;);S(e,256,t)}function L(e,t){var i,r,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,h=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<u;i++)0!==s[2*i]?(e.heap[++e.heap_len]=h=i,e.depth[i]=0):s[2*i+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=h<2?++h:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=h,i=e.heap_len>>1;1<=i;i--)N(e,s,i);for(n=u;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,s[2*n]=s[2*i]+s[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,s[2*i+1]=s[2*r+1]=n,e.heap[1]=n++,N(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,s,o,a,u=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,m=0;for(s=0;s<=l;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)_<(s=u[2*u[2*(r=e.heap[i])+1]+1]+1)&&(s=_,m++),u[2*r+1]=s,h<r||(e.bl_count[s]++,o=0,p<=r&&(o=f[r-p]),a=u[2*r],e.opt_len+=a*(s+o),d&&(e.static_len+=a*(c[2*r+1]+o)));if(0!==m){do{for(s=_-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[_]--,m-=2}while(0<m);for(s=_;0!==s;s--)for(r=e.bl_count[s];0!==r;)h<(n=e.heap[--i])||(u[2*n+1]!==s&&(e.opt_len+=(s-u[2*n+1])*u[2*n],u[2*n+1]=s),r--)}}(e,t),z(s,h,e.bl_count)}function I(e,t,i){var r,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++a<l&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4))}function F(e,t,i){var r,n,s=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++a<l&&n===o)){if(a<u)for(;S(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(S(e,n,e.bl_tree),a--),S(e,16,e.bl_tree),E(e,a-3,2)):a<=10?(S(e,17,e.bl_tree),E(e,a-3,3)):(S(e,18,e.bl_tree),E(e,a-11,7));s=n,u=(a=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4)}}n(x);var D=!1;function U(e,t,i,n){E(e,0+(n?1:0),3),function(e,t,i){P(e),k(e,i),k(e,~i),r.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i)}i._tr_init=function(e){D||(function(){var e,t,i,r,n,s=new Array(16);for(r=i=0;r<28;r++)for(g[r]=i,e=0;e<1<<u[r];e++)m[i++]=r;for(m[i-1]=r,r=n=0;r<16;r++)for(x[r]=n,e=0;e<1<<h[r];e++)_[n++]=r;for(n>>=7;r<a;r++)for(x[r]=n<<7,e=0;e<1<<h[r]-7;e++)_[256+n++]=r;for(t=0;t<=l;t++)s[t]=0;for(e=0;e<=143;)f[2*e+1]=8,e++,s[8]++;for(;e<=255;)f[2*e+1]=9,e++,s[9]++;for(;e<=279;)f[2*e+1]=7,e++,s[7]++;for(;e<=287;)f[2*e+1]=8,e++,s[8]++;for(z(f,287,s),e=0;e<a;e++)p[2*e+1]=5,p[2*e]=R(e,5);y=new w(f,u,257,o,l),b=new w(p,h,0,a,l),v=new w(new Array(0),c,0,19,7)}(),D=!0),e.l_desc=new A(e.dyn_ltree,y),e.d_desc=new A(e.dyn_dtree,b),e.bl_desc=new A(e.bl_tree,v),e.bi_buf=0,e.bi_valid=0,M(e)},i._tr_stored_block=U,i._tr_flush_block=function(e,t,i,r){var n,o,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),L(e,e.l_desc),L(e,e.d_desc),a=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),L(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?U(e,t,i,r):4===e.strategy||o===n?(E(e,2+(r?1:0),3),C(e,f,p)):(E(e,4+(r?1:0),3),function(e,t,i,r){var n;for(E(e,t-257,5),E(e,i-1,5),E(e,r-4,4),n=0;n<r;n++)E(e,e.bl_tree[2*d[n]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),C(e,e.dyn_ltree,e.dyn_dtree)),M(e),r&&P(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(m[i]+s+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){E(e,2,3),S(e,256,f),function(e){16===e.bi_valid?(k(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,s=1,o={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];xe.push(new Ee(e,t)),1!==xe.length||we||be(ke)}(function(){c(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){r.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(c,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[s]=n,t(s),s++},u.clearImmediate=h}function h(e){delete o[e]}function c(e){if(a)setTimeout(c,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(undefined,i)}}(t)}finally{h(e),a=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&c(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),ut.exports),ct=e.getDefaultExportFromCjs(ht),dt={},ft={},pt={};function _t(){if(Me)return pt;function e(e){return null==e}return Me=1,pt.isNothing=e,pt.isObject=function(e){return"object"==typeof e&&null!==e},pt.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},pt.repeat=function(e,t){var i,r="";for(i=0;i<t;i+=1)r+=e;return r},pt.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},pt.extend=function(e,t){var i,r,n,s;if(t)for(i=0,r=(s=Object.keys(t)).length;i<r;i+=1)e[n=s[i]]=t[n];return e},pt}function mt(){if(Oe)return Pe;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Oe=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Pe=e}function gt(){if(Ie)return Le;Ie=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];return Le=function(r,n){if(n=n||{},Object.keys(n).forEach(function(i){if(-1===t.indexOf(i))throw new e('Unknown option "'+i+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(e){return e},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.defaultStyle=n.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(i){e[i].forEach(function(e){t[String(e)]=i})}),t}(n.styleAliases||null),-1===i.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')},Le}function yt(){if(De)return Fe;De=1;var e=_t(),t=mt(),i=gt();function r(e,t,i){var n=[];return e.include.forEach(function(e){i=r(e,t,i)}),e[t].forEach(function(e){i.forEach(function(t,i){t.tag===e.tag&&n.push(i)}),i.push(e)}),i.filter(function(e,t){return-1===n.indexOf(t)})}function n(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=r(this,"implicit",[]),this.compiledExplicit=r(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,i={};function r(e){i[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return i}(this.compiledImplicit,this.compiledExplicit)}return n.DEFAULT=null,n.create=function(){var r,s;switch(arguments.length){case 1:r=n.DEFAULT,s=arguments[0];break;case 2:r=arguments[0],s=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(r=e.toArray(r),s=e.toArray(s),!r.every(function(e){return e instanceof n}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!s.every(function(e){return e instanceof i}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new n({include:r,explicit:s})},Fe=n}function bt(){if(je)return Ue;je=1;var e=gt();return Ue=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Ge)return Be;Ge=1;var e=gt();return Be=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function xt(){if($e)return Ve;$e=1;var e=gt();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function wt(){if(We)return qe;We=1;var e=yt();return qe=new e({explicit:[bt(),vt(),xt()]})}function At(){if(He)return Ze;He=1;var e=gt();return Ze=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function Tt(){if(Ye)return Xe;Ye=1;var e=gt();return Xe=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function kt(){if(Ke)return Je;Ke=1;var e=_t(),t=gt();function i(e){return 48<=e&&e<=55}function r(e){return 48<=e&&e<=57}return Je=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,s=e.length,o=0,a=!1;if(!s)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===s)return!0;if("b"===(t=e[++o])){for(o++;o<s;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(o++;o<s;o++)if("_"!==(t=e[o])){if(!(48<=(n=e.charCodeAt(o))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(!i(e.charCodeAt(o)))return!1;a=!0}return a}for(;o<s;o++)if("_"!==(t=e[o])){if(":"===t)break;if(!r(e.charCodeAt(o)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(o)))},construct:function(e){var t,i,r=e,n=1,s=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r?0:"0"===t?"b"===r[1]?n*parseInt(r.slice(2),2):"x"===r[1]?n*parseInt(r,16):n*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach(function(e){s.unshift(parseInt(e,10))}),r=0,i=1,s.forEach(function(e){r+=e*i,i*=60}),n*r):n*parseInt(r,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Je}function Et(){if(et)return Qe;et=1;var e=_t(),t=gt(),i=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=/^[-+]?[0-9]+e/;return Qe=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!i.test(e)},construct:function(e){var t,i,r,n;return i="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,n=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){n.unshift(parseFloat(e,10))}),t=0,r=1,n.forEach(function(e){t+=e*r,r*=60}),i*t):i*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,i){var n;if(isNaN(t))switch(i){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(i){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(i){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return n=t.toString(10),r.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})}function St(){if(it)return tt;it=1;var e=yt();return tt=new e({include:[wt()],implicit:[At(),Tt(),kt(),Et()]})}function Rt(){if(nt)return rt;nt=1;var e=yt();return rt=new e({include:[St()]})}function zt(){if(ot)return st;ot=1;var e=gt(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return st=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var i,r,n,s,o,a,l,u,h=0,c=null;if(null===(i=t.exec(e)))throw new Error("Date resolve error");if(r=+i[1],n=+i[2]-1,s=+i[3],!i[4])return new Date(Date.UTC(r,n,s));if(o=+i[4],a=+i[5],l=+i[6],i[7]){for(h=i[7].slice(0,3);h.length<3;)h+="0";h=+h}return i[9]&&(c=6e4*(60*+i[10]+ +(i[11]||0)),"-"===i[9]&&(c=-c)),u=new Date(Date.UTC(r,n,s,o,a,l,h)),c&&u.setTime(u.getTime()-c),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Mt(){if(lt)return at;lt=1;var e=gt();return at=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Pt,Ot,Nt,Ct,Lt,It,Ft,Dt,Ut,jt,Bt,Gt,Vt,$t,qt,Wt,Zt,Ht,Xt,Yt,Jt,Kt,Qt=e.getAugmentedNamespace(pe);function ei(){if(Ot)return Pt;Ot=1;var e=Qt.Buffer,t=gt(),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Pt=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,s=e.length,o=i;for(r=0;r<s;r++)if(!((t=o.indexOf(e.charAt(r)))>64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(t){var r,n,s=t.replace(/[\r\n=]/g,""),o=s.length,a=i,l=0,u=[];for(r=0;r<o;r++)r%4==0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(s.charAt(r));return 0==(n=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,r,n="",s=0,o=e.length,a=i;for(t=0;t<o;t++)t%3==0&&t&&(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]),s=(s<<8)+e[t];return 0==(r=o%3)?(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]):2===r?(n+=a[s>>10&63],n+=a[s>>4&63],n+=a[s<<2&63],n+=a[64]):1===r&&(n+=a[s>>2&63],n+=a[s<<4&63],n+=a[64],n+=a[64]),n}}),Pt}function ti(){if(Ct)return Nt;Ct=1;var e=gt(),t=Object.prototype.hasOwnProperty,i=Object.prototype.toString;return Nt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,n,s,o,a,l=[],u=e;for(r=0,n=u.length;r<n;r+=1){if(s=u[r],a=!1,"[object Object]"!==i.call(s))return!1;for(o in s)if(t.call(s,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),Nt}function ii(){if(It)return Lt;It=1;var e=gt(),t=Object.prototype.toString;return Lt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var i,r,n,s,o,a=e;for(o=new Array(a.length),i=0,r=a.length;i<r;i+=1){if(n=a[i],"[object Object]"!==t.call(n))return!1;if(1!==(s=Object.keys(n)).length)return!1;o[i]=[s[0],n[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,i,r,n,s,o=e;for(s=new Array(o.length),t=0,i=o.length;t<i;t+=1)r=o[t],n=Object.keys(r),s[t]=[n[0],r[n[0]]];return s}}),Lt}function ri(){if(Dt)return Ft;Dt=1;var e=gt(),t=Object.prototype.hasOwnProperty;return Ft=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var i,r=e;for(i in r)if(t.call(r,i)&&null!==r[i])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function ni(){if(jt)return Ut;jt=1;var e=yt();return Ut=new e({include:[Rt()],implicit:[zt(),Mt()],explicit:[ei(),ti(),ii(),ri()]})}function si(){if(Gt)return Bt;Gt=1;var e=gt();return Bt=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function oi(){if($t)return Vt;$t=1;var e=gt();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,i=/\/([gim]*)$/.exec(e),r="";if("/"===t[0]){if(i&&(r=i[1]),r.length>3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,i=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(i&&(r=i[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function ai(){if(Wt)return qt;var e;Wt=1;try{e=Re("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=gt();return qt=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var i="("+t+")",r=e.parse(i,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&"FunctionExpression"===r.body[0].expression.type}catch(e){return!1}},construct:function(t){var i,r="("+t+")",n=e.parse(r,{range:!0}),s=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach(function(e){s.push(e.name)}),i=n.body[0].expression.body.range,new Function(s,r.slice(i[0]+1,i[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function li(){if(Ht)return Zt;Ht=1;var e=yt();return Zt=e.DEFAULT=new e({include:[ni()],explicit:[si(),oi(),ai()]})}var ui=function(){if(Kt)return Jt;Kt=1;var e=function(){if(Yt)return dt;Yt=1;var e=function(){if(Xt)return ft;Xt=1;var e=_t(),t=mt(),i=function(){if(Ce)return Ne;Ce=1;var e=_t();function t(e,t,i,r,n){this.name=e,this.buffer=t,this.position=i,this.line=r,this.column=n}return t.prototype.getSnippet=function(t,i){var r,n,s,o,a;if(!this.buffer)return null;for(t=t||4,i=i||75,r="",n=this.position;n>0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>i/2-1){r=" ... ",n+=5;break}for(s="",o=this.position;o<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>i/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),e.repeat(" ",t)+r+a+s+"\n"+e.repeat(" ",t+this.position-n+r.length)+"^"},t.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(i+=":\n"+t),i},Ne=t}(),r=ni(),n=li(),s=Object.prototype.hasOwnProperty,o=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,h=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function c(e){return 10===e||13===e}function d(e){return 9===e||32===e}function f(e){return 9===e||32===e||10===e||13===e}function p(e){return 44===e||91===e||93===e||123===e||125===e}function _(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function m(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function g(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var y=new Array(256),b=new Array(256),v=0;v<256;v++)y[v]=m(v)?1:0,b[v]=m(v);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||n,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,r){return new t(r,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function A(e,t){throw w(e,t)}function T(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var k={YAML:function(e,t,i){var r,n,s;null!==e.version&&A(e,"duplication of %YAML directive"),1!==i.length&&A(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&A(e,"ill-formed argument of the YAML directive"),n=parseInt(r[1],10),s=parseInt(r[2],10),1!==n&&A(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&T(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var r,n;2!==i.length&&A(e,"TAG directive accepts exactly two arguments"),r=i[0],n=i[1],u.test(r)||A(e,"ill-formed tag handle (first argument) of the TAG directive"),s.call(e.tagMap,r)&&A(e,'there is a previously declared suffix for "'+r+'" tag handle'),h.test(n)||A(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=n}};function E(e,t,i,r){var n,s,a,l;if(t<i){if(l=e.input.slice(t,i),r)for(n=0,s=l.length;n<s;n+=1)9===(a=l.charCodeAt(n))||32<=a&&a<=1114111||A(e,"expected valid JSON character");else o.test(l)&&A(e,"the stream contains non-printable characters");e.result+=l}}function S(t,i,r,n){var o,a,l,u;for(e.isObject(r)||A(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(o=Object.keys(r)).length;l<u;l+=1)a=o[l],s.call(i,a)||(i[a]=r[a],n[a]=!0)}function R(e,t,i,r,n,o){var a,l;if(n=String(n),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(o))for(a=0,l=o.length;a<l;a+=1)S(e,t,o[a],i);else S(e,t,o,i);else e.json||s.call(i,n)||!s.call(t,n)||A(e,"duplicated mapping key"),t[n]=o,delete i[n];return t}function z(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):A(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function M(e,t,i){for(var r=0,n=e.input.charCodeAt(e.position);0!==n;){for(;d(n);)n=e.input.charCodeAt(++e.position);if(t&&35===n)do{n=e.input.charCodeAt(++e.position)}while(10!==n&&13!==n&&0!==n);if(!c(n))break;for(z(e),n=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===n;)e.lineIndent++,n=e.input.charCodeAt(++e.position)}return-1!==i&&0!==r&&e.lineIndent<i&&T(e,"deficient indentation"),r}function P(e){var t,i=e.position;return!(45!==(t=e.input.charCodeAt(i))&&46!==t||t!==e.input.charCodeAt(i+1)||t!==e.input.charCodeAt(i+2)||(i+=3,0!==(t=e.input.charCodeAt(i))&&!f(t)))}function O(t,i){1===i?t.result+=" ":i>1&&(t.result+=e.repeat("\n",i-1))}function N(e,t){var i,r,n=e.tag,s=e.anchor,o=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),r=e.input.charCodeAt(e.position);0!==r&&45===r&&f(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,M(e,!0,-1)&&e.lineIndent<=t)o.push(null),r=e.input.charCodeAt(e.position);else if(i=e.line,I(e,t,3,!1,!0),o.push(e.result),M(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>t)&&0!==r)A(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=n,e.anchor=s,e.kind="sequence",e.result=o,!0)}function C(e){var t,i,r,n,o=!1,a=!1;if(33!==(n=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&A(e,"duplication of a tag property"),60===(n=e.input.charCodeAt(++e.position))?(o=!0,n=e.input.charCodeAt(++e.position)):33===n?(a=!0,i="!!",n=e.input.charCodeAt(++e.position)):i="!",t=e.position,o){do{n=e.input.charCodeAt(++e.position)}while(0!==n&&62!==n);e.position<e.length?(r=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):A(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==n&&!f(n);)33===n&&(a?A(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),u.test(i)||A(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),n=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),l.test(r)&&A(e,"tag suffix cannot contain flow indicator characters")}return r&&!h.test(r)&&A(e,"tag name cannot contain such characters: "+r),o?e.tag=r:s.call(e.tagMap,i)?e.tag=e.tagMap[i]+r:"!"===i?e.tag="!"+r:"!!"===i?e.tag="tag:yaml.org,2002:"+r:A(e,'undeclared tag handle "'+i+'"'),!0}function L(e){var t,i;if(38!==(i=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&A(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!f(i)&&!p(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function I(t,i,r,n,o){var a,l,u,h,m,v,x,w,T=1,k=!1,S=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===r||3===r,n&&M(t,!0,-1)&&(k=!0,t.lineIndent>i?T=1:t.lineIndent===i?T=0:t.lineIndent<i&&(T=-1)),1===T)for(;C(t)||L(t);)M(t,!0,-1)?(k=!0,u=a,t.lineIndent>i?T=1:t.lineIndent===i?T=0:t.lineIndent<i&&(T=-1)):u=!1;if(u&&(u=k||o),1!==T&&4!==r||(x=1===r||2===r?i:i+1,w=t.position-t.lineStart,1===T?u&&(N(t,w)||function(e,t,i){var r,n,s,o,a=e.tag,l=e.anchor,u={},h={},c=null,p=null,_=null,m=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),o=e.input.charCodeAt(e.position);0!==o;){if(r=e.input.charCodeAt(e.position+1),s=e.line,63!==o&&58!==o||!f(r)){if(!I(e,i,2,!1,!0))break;if(e.line===s){for(o=e.input.charCodeAt(e.position);d(o);)o=e.input.charCodeAt(++e.position);if(58===o)f(o=e.input.charCodeAt(++e.position))||A(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(R(e,u,h,c,p,null),c=p=_=null),g=!0,m=!1,n=!1,c=e.tag,p=e.result;else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=a,e.anchor=l,!0;A(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===o?(m&&(R(e,u,h,c,p,null),c=p=_=null),g=!0,m=!0,n=!0):m?(m=!1,n=!0):A(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,o=r;if((e.line===s||e.lineIndent>t)&&(I(e,t,4,!0,n)&&(m?p=e.result:_=e.result),m||(R(e,u,h,c,p,_),c=p=_=null),M(e,!0,-1),o=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==o)A(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&R(e,u,h,c,p,null),g&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),g}(t,w,x))||function(e,t){var i,r,n,s,o,a,l,u,h,c,d=!0,p=e.tag,_=e.anchor,m={};if(91===(c=e.input.charCodeAt(e.position)))n=93,a=!1,r=[];else{if(123!==c)return!1;n=125,a=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),c=e.input.charCodeAt(++e.position);0!==c;){if(M(e,!0,t),(c=e.input.charCodeAt(e.position))===n)return e.position++,e.tag=p,e.anchor=_,e.kind=a?"mapping":"sequence",e.result=r,!0;d||A(e,"missed comma between flow collection entries"),h=null,s=o=!1,63===c&&f(e.input.charCodeAt(e.position+1))&&(s=o=!0,e.position++,M(e,!0,t)),i=e.line,I(e,t,1,!1,!0),u=e.tag,l=e.result,M(e,!0,t),c=e.input.charCodeAt(e.position),!o&&e.line!==i||58!==c||(s=!0,c=e.input.charCodeAt(++e.position),M(e,!0,t),I(e,t,1,!1,!0),h=e.result),a?R(e,r,m,u,l,h):s?r.push(R(e,null,m,u,l,h)):r.push(l),M(e,!0,t),44===(c=e.input.charCodeAt(e.position))?(d=!0,c=e.input.charCodeAt(++e.position)):d=!1}A(e,"unexpected end of the stream within a flow collection")}(t,x)?S=!0:(l&&function(t,i){var r,n,s,o,a,l=1,u=!1,h=i,f=0,p=!1;if(124===(o=t.input.charCodeAt(t.position)))n=!1;else{if(62!==o)return!1;n=!0}for(t.kind="scalar",t.result="";0!==o;)if(43===(o=t.input.charCodeAt(++t.position))||45===o)1===l?l=43===o?3:2:A(t,"repeat of a chomping mode identifier");else{if(!((s=48<=(a=o)&&a<=57?a-48:-1)>=0))break;0===s?A(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?A(t,"repeat of an indentation width identifier"):(h=i+s-1,u=!0)}if(d(o)){do{o=t.input.charCodeAt(++t.position)}while(d(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!c(o)&&0!==o)}for(;0!==o;){for(z(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndent<h)&&32===o;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>h&&(h=t.lineIndent),c(o))f++;else{if(t.lineIndent<h){3===l?t.result+=e.repeat("\n",f):1===l&&u&&(t.result+="\n");break}for(n?d(o)?(p=!0,t.result+=e.repeat("\n",f+1)):p?(p=!1,t.result+=e.repeat("\n",f+1)):0===f?u&&(t.result+=" "):t.result+=e.repeat("\n",f):t.result+=u?e.repeat("\n",f+1):e.repeat("\n",f),u=!0,f=0,r=t.position;!c(o)&&0!==o;)o=t.input.charCodeAt(++t.position);E(t,r,t.position,!1)}}return!0}(t,x)||function(e,t){var i,r,n;if(39!==(i=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(i=e.input.charCodeAt(e.position));)if(39===i){if(E(e,r,e.position,!0),39!==(i=e.input.charCodeAt(++e.position)))return!0;r=n=e.position,e.position++}else c(i)?(E(e,r,n,!0),O(e,M(e,!1,t)),r=n=e.position):e.position===e.lineStart&&P(e)?A(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);A(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var i,r,n,s,o,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return E(e,i,e.position,!0),e.position++,!0;if(92===a){if(E(e,i,e.position,!0),c(a=e.input.charCodeAt(++e.position)))M(e,!1,t);else if(a<256&&y[a])e.result+=b[a],e.position++;else if((o=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(n=o,s=0;n>0;n--)(o=_(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:A(e,"expected hexadecimal character");e.result+=g(s),e.position++}else A(e,"unknown escape sequence");i=r=e.position}else c(a)?(E(e,i,r,!0),O(e,M(e,!1,t)),i=r=e.position):e.position===e.lineStart&&P(e)?A(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}A(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?S=!0:function(e){var t,i,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!f(r)&&!p(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&A(e,"name of an alias node must contain at least one character"),i=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(i)||A(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],M(e,!0,-1),!0}(t)?(S=!0,null===t.tag&&null===t.anchor||A(t,"alias node should not have any properties")):function(e,t,i){var r,n,s,o,a,l,u,h,_=e.kind,m=e.result;if(f(h=e.input.charCodeAt(e.position))||p(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return!1;if((63===h||45===h)&&(f(r=e.input.charCodeAt(e.position+1))||i&&p(r)))return!1;for(e.kind="scalar",e.result="",n=s=e.position,o=!1;0!==h;){if(58===h){if(f(r=e.input.charCodeAt(e.position+1))||i&&p(r))break}else if(35===h){if(f(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&P(e)||i&&p(h))break;if(c(h)){if(a=e.line,l=e.lineStart,u=e.lineIndent,M(e,!1,-1),e.lineIndent>=t){o=!0,h=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=l,e.lineIndent=u;break}}o&&(E(e,n,s,!1),O(e,e.line-a),n=s=e.position,o=!1),d(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return E(e,n,s,!1),!!e.result||(e.kind=_,e.result=m,!1)}(t,x,1===r)&&(S=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===T&&(S=u&&N(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(h=0,m=t.implicitTypes.length;h<m;h+=1)if((v=t.implicitTypes[h]).resolve(t.result)){t.result=v.construct(t.result),t.tag=v.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else s.call(t.typeMap,t.tag)?(v=t.typeMap[t.tag],null!==t.result&&v.kind!==t.kind&&A(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+v.kind+'", not "'+t.kind+'"'),v.resolve(t.result)?(t.result=v.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):A(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):A(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||S}function F(e){var t,i,r,n,o=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(n=e.input.charCodeAt(e.position))&&(M(e,!0,-1),n=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==n));){for(l=!0,n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!f(n);)n=e.input.charCodeAt(++e.position);for(r=[],(i=e.input.slice(t,e.position)).length<1&&A(e,"directive name must not be less than one character in length");0!==n;){for(;d(n);)n=e.input.charCodeAt(++e.position);if(35===n){do{n=e.input.charCodeAt(++e.position)}while(0!==n&&!c(n));break}if(c(n))break;for(t=e.position;0!==n&&!f(n);)n=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==n&&z(e),s.call(k,i)?k[i](e,i,r):T(e,'unknown document directive "'+i+'"')}M(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,M(e,!0,-1)):l&&A(e,"directives end mark is expected"),I(e,e.lineIndent-1,4,!1,!0),M(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(o,e.position))&&T(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&P(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,M(e,!0,-1)):e.position<e.length-1&&A(e,"end of the stream or a document separator is expected")}function D(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var i=new x(e,t);for(i.input+="\0";32===i.input.charCodeAt(i.position);)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)F(i);return i.documents}function U(e,t,i){var r,n,s=D(e,i);for(r=0,n=s.length;r<n;r+=1)t(s[r])}function j(e,i){var r=D(e,i);if(0!==r.length){if(1===r.length)return r[0];throw new t("expected a single document in the stream, but found more")}}return ft.loadAll=U,ft.load=j,ft.safeLoadAll=function(t,i,n){U(t,i,e.extend({schema:r},n))},ft.safeLoad=function(t,i){return j(t,e.extend({schema:r},i))},ft}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return dt.Type=gt(),dt.Schema=yt(),dt.FAILSAFE_SCHEMA=wt(),dt.JSON_SCHEMA=St(),dt.CORE_SCHEMA=Rt(),dt.DEFAULT_SAFE_SCHEMA=ni(),dt.DEFAULT_FULL_SCHEMA=li(),dt.load=e.load,dt.loadAll=e.loadAll,dt.safeLoad=e.safeLoad,dt.safeLoadAll=e.safeLoadAll,dt.YAMLException=mt(),dt.MINIMAL_SCHEMA=wt(),dt.SAFE_SCHEMA=ni(),dt.DEFAULT_SCHEMA=li(),dt.scan=t("scan"),dt.parse=t("parse"),dt.compose=t("compose"),dt.addConstructor=t("addConstructor"),dt}();return Jt=e}(),hi=e.getDefaultExportFromCjs(ui);class ci{constructor(t,i,r=null){this.url=t,!i||e.isRelativeURL(i)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=i,this.path_for_parent=i||this.path,this.parent=r,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return fi(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return h(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class di extends ci{constructor(e,t,i){super(e,t,i),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return h(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),fi(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],i=[];this.zip.forEach((e,r)=>{r.dir||(t.push(e),i.push(r.async("arraybuffer")))});const r=await Promise.all(i);for(let i=0;i<r.length;i++){let n=t[i],s=n.split("/").length-1;this.files[n]={data:r[i],type:e.extensionForURL(n),depth:s}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function fi(t){return new Promise((i,r)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{i(function(e){return hi.safeLoad(e,{json:!0})}(e))}catch(e){r(e)}},r):(t=Object.assign({},t),i(t))})}const pi={async loadScene(t,{path:i,type:r}={}){const n=[],s={},o=await this.loadSceneRecursive({url:t,path:i,type:r},null,s,n),{config:a,bundle:l}=this.finalize(o);if(!a)throw n[0];return n.length>0&&n.forEach(t=>{const i=`Failed to import scene: ${t.url}`;e.log("error",i,t),this.trigger("error",{type:"scene_import",message:i,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:s}},async loadSceneRecursive({url:t,path:i,type:r},n,s={},o=[]){if(!t)return{};const a=function(t,i,r,n=null){return null!=n&&"zip"===n||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new di(t,i,r):new ci(t,i,r)}(t,i,n,r);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,s),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const i=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),i.push(a.resourceFor(t))}),delete t.import;const r=i.map(e=>this.loadSceneRecursive(e,a,s,o)),n=(await Promise.all(r)).map(e=>this.normalize(e.config,e.bundle,s)).map(e=>e.config);return this.normalize(t,a,s),t=e.mergeObjects(...n,t),{config:t,bundle:a,texture_nodes:s}}catch(e){return e.url=t,o.push(e),{}}},normalize(e,t,i={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,i),{config:e,bundle:t,texture_nodes:i}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const i in e.sources)this.normalizeDataSource(e.sources[i],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const i in e.scripts)e.scripts[i]=t.urlFor(e.scripts[i])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const i=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of i)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const i in e.textures){const r=e.textures[i];r.url&&(r.url=t.urlFor(r.url))}},collectTextures(t,i,r){if(t.styles)for(const e in t.styles){const n=t.styles[e],s=n.texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"texture"];this.addTextureNode(t,i,r)}n.material&&["emission","ambient","diffuse","specular","normal"].forEach(s=>{const o=null!=n.material[s]&&n.material[s].texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"material",s,"texture"];this.addTextureNode(t,i,r)}})}if(t.styles)for(const n in t.styles){const s=t.styles[n];s.shaders&&s.shaders.uniforms&&e.GLSL.parseUniforms(s.shaders.uniforms).forEach(({type:e,value:s,path:o})=>{if("sampler2D"===e&&"string"==typeof s&&!t.textures[s]){const e=["styles",n,"shaders","uniforms",...o];this.addTextureNode(e,i,r)}})}if(t.layers){const n=[t.layers],s=[["layers"]];for(;n.length>0;){const o=n.pop(),a=s.pop();if("object"==typeof o&&!Array.isArray(o))for(const l in o)if("draw"===l){const e=o[l];for(const n in e){if(e[n].texture){const s=e[n].texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"texture"];this.addTextureNode(e,i,r)}}if(e[n].outline&&e[n].outline.texture){const s=e[n].outline.texture;if("string"==typeof s&&!t.textures[s]){const e=[...a,l,"draw",n,"outline","texture"];this.addTextureNode(e,i,r)}}}}else{if(e.isReserved(l))continue;n.push(o[l]),s.push([...a,l])}}}},addTextureNode(e,t,i){i[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,i={}){for(const{path:r,bundle:n}of Object.values(i)){const i=s(e,r);if("string"==typeof i&&null==e.textures[i])if(c(e,r)){const r=t.urlFor(i);e.textures[i]={url:r}}else{const t=n.urlFor(i);e.textures[t]={url:t},o(e,r,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?f(d(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(pi);class _i{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let i=0;for(;i<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;i++}}getDescendants(t,i=0){let r=[];if(i<this.max_proxy_descendant_depth){let n=e.TileID.children(t,this.children_cache);if(!n)return;n.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?r.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&r.push(...this.getDescendants(e,i+1)))})}return r}}let mi={},gi={};function yi(t,i=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,i);if(this.obbs)for(let r=0;r<this.obbs.length;r++){let n={aabb:this.aabbs[r],obb:this.obbs[r]};if(e.Label.prototype.occluded.call(n,t,i))return!0}return!1}class bi{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new _i,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var i=this.tiles[t];null!=i&&i.destroy(),this.forgetTile(i.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let i in this.tiles)e(this.tiles[i])&&t.push(i);for(let e=0;e<t.length;e++){let i=t[e];this.removeTile(i)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const i=e[t];this.queueCoordinate(i),this.visible_coords[i.key]=i}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const i=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===i.length?Promise.resolve({}):(i.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===vi(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(i.map(e=>e.key))&&this.collision.mesh_set===xi(i)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=vi(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(i.map(e=>e.key)),this.collision.mesh_set=xi(i),this.collision.task={type:"tileManagerUpdateLabels",run:async function(r){const n=await async function(t,i,r=!1){gi=mi,mi={};let n=function(t,i){let r={};t.forEach(t=>{const n=e.Geo.unitsPerMeter(t.coords.z),s=Math.pow(2,i-t.style_z),o=n*s,a=e.Geo.metersPerPixel(i),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let i in l)l[i].forEach(i=>{if(i.labels)for(let s in i.labels){if(t.isProxy()&&!gi[s])continue;const l=i.labels[s].container.label,u=i.labels[s].container.linked,h=i.labels[s].ranges;let c={};if(c.discard=yi.bind(c),c.build_id=t.build_id,Object.assign(c,l),c.layout=Object.assign({},l.layout),c.layout.repeat_scale=.75,c.layout.repeat_distance=c.layout.repeat_distance||0,c.layout.repeat_distance/=o,c.position=[c.position[0]/n+t.min.x,c.position[1]/n+t.min.y],c.unit_scale=a,"point"===c.type)e.LabelPoint.prototype.updateBBoxes.call(c);else if("straight"===c.type)e.LabelLineStraight.prototype.updateBBoxes.call(c,c.position,c.size,c.angle,c.angle,c.offset);else if(l.obbs){const i=l.obbs.map(i=>{let{x:r,y:s,a:a,w:l,h:u}=i;return r=r/n+t.min.x,s=s/n+t.min.y,l/=o,u/=o,new e.OBB(r,s,a,l,u)});c.obbs=i,c.aabbs=i.map(e=>e.getExtent())}r[s]={label:c,linked:u,ranges:h,mesh:i}}})});for(let e in r){const t=r[e];t.linked&&(t.linked=r[t.linked])}return r=Object.keys(r).map(e=>r[e]),r}(t,i);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const s=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),o=Math.floor(s/e.Geo.tile_size);o>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/o}):e.Collision.initGrid();const a=await e.Collision.collide(n,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||r&&e.label.breach&&!gi[e.label.id]||(t=1),t&&(mi[e.label.id]=!0);let i=!0;e.ranges.forEach(r=>{if(!i)return;let n=e.mesh;if(!n.valid)return;let s=n.vertex_layout.offset.a_shape,o=n.vertex_layout.stride;for(let e=0;e<r[1];e++){if(n.vertex_data[r[0]+e*o+s+6]===t)return void(i=!1);n.vertex_data[r[0]+e*o+s+6]=t}-1===l.indexOf(n)&&l.push(n)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:n}}(i,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(r,n),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const i=this.pyramid.getAncestor(t);if(i)i.setProxyFor(t),e=!0;else{const i=this.pyramid.getDescendants(t);for(let r=0;r<i.length;r++)i[r].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let i in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[i])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,i)=>{let r=this.view.center.meters,n=e.Geo.metersPerTile(t.z)/2,s=e.Geo.metersForTile(t);s.x+=n,s.y-=n;let o=e.Geo.metersForTile(i);o.x+=n,o.y-=n;let a=Math.abs(r.x-s.x)+Math.abs(r.y-s.y),l=Math.abs(r.x-o.x)+Math.abs(r.y-o.y);return t.center_dist=a,i.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let i in this.scene.sources){let r=this.scene.sources[i];if(!r.builds_geometry_tiles||!r.includesTile(t,this.view.tile_zoom))continue;let n=e.TileID.normalizedKey(t,r,this.view.tile_zoom);if(n&&!this.hasTile(n)){e.log("trace",`load tile ${n}, distance from view center: ${t.center_dist}`);let i=new e.Tile({source:r,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(i),this.buildTile(i)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:i}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}i.done&&(t.built=!0),t.buildMeshes(this.scene.styles,i),this.updateTileStates(),this.scene.requestRedraw()}i.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var i=[];for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||i.push(this.tiles[r].debug[e]);return i}getDebugSum(e,t){var i=0;for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||(i+=this.tiles[r].debug[e]);return i}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function vi(e,t,i=2){return(Math.floor(e*t)/t).toFixed(i)}function xi(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class wi{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class Ai{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new wi({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new wi({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new wi({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new wi({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Ti{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,i=this.canvas.height,r=new Uint8Array(t*i*4);this.gl.readPixels(0,0,t,i,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r);let n=this.queue_screenshot.background;n=n&&"transparent"!==n?e.StyleParser.parseColor(n).slice(0,3).map(e=>255*e):null;let s=new Uint8ClampedArray(t*i*4);for(let e=0;e<i;e++)for(let o=0;o<t;o++){let a=4*((i-e-1)*t+o),l=4*(e*t+o),u=r[a+3];s[l+0]=255*r[a+0]/u,s[l+1]=255*r[a+1]/u,s[l+2]=255*r[a+2]/u,s[l+3]=u,n&&(u/=255,s[l+0]=s[l+0]*u+n[0]*(1-u),s[l+1]=s[l+1]*u+n[1]*(1-u),s[l+2]=s[l+2]*u+n[2]*(1-u),s[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let o=this.screenshot_canvas;o.width=t,o.height=i,this.screenshot_context=this.screenshot_context||o.getContext("2d");let a=this.screenshot_context,l=new ImageData(s,t,i);a.putImageData(l,0,0);const u=o.toDataURL("image/png"),h=atob(u.slice(22)),c=new Uint8Array(h.length);for(let e=0;e<h.length;++e)c[e]=h.charCodeAt(e);const d=new Blob([c],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:d,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=i=>{if(i.data.size>0&&t.chunks.push(i.data),t.resolve){let i=new Blob(t.chunks,{type:t.options.mimeType}),r=e.createObjectURL(i);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:r,blob:i,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function ki(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function Ei(t){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?ki(Object(r),!0).forEach(function(i){e._defineProperty(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ki(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}class Si{constructor(t,i){var r;i=i||{},e.subscribeMixin(this),this.id=Si.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,i),this.tile_manager=new bi({scene:this}),this.num_workers=i.numWorkers||2,!0===i.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===i.highDensityDisplay||i.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,i.preUpdate&&this.subscribe({pre_update:i.preUpdate}),i.postUpdate&&this.subscribe({post_update:i.postUpdate}),this.render_loop=!i.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Ti,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===i.introspection,this.times={},this.resetTime(),this.container=i.container,this.canvas=null,this.contextOptions=i.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=Si.generation,this.last_complete_generation=Si.generation,(r=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profileEnd",t)},timeRebuild(t=1,i={}){let n=[],s=()=>{let o=+new Date;r.rebuild(i).then(()=>{if(n.push(+new Date-o),n.length<t)s();else{let i=~~(n.reduce((e,t)=>e+t)/n.length);e.log("info",`Profiled rebuild ${t} times: ${i} avg (${Math.min(...n)} min, ${Math.max(...n)} max)`)}})};s()},geometryCountByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let i in t.meshes)e[i]=e[i]||0,t.meshes[i].forEach(t=>{e[i]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=r.debug.geometryCountByStyle(),t={};for(let i in e){let n=r.styles[i].baseStyle();t[n]=t[n]||0,t[n]+=e[i]}return t},geometryCountTotal(){const e=r.debug.geometryCountByStyle();return Object.keys(e).reduce((t,i)=>e[i]+t,0)},geometrySizeByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let i in t.meshes)e[i]=e[i]||0,t.meshes[i].forEach(t=>{e[i]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=r.debug.geometrySizeByStyle(),t={};for(let i in e){let n=r.styles[i].baseStyle();t[n]=t[n]||0,t[n]+=e[i]}return t},geometrySizeTotal(){const e=r.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,i)=>e[i]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(r.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>r.tile_manager.getRenderableTiles().length},this.log_level=i.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new Si(e,t)}load(t=null,i={}){var r=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(i="string"==typeof i?{base_path:i}:i).blocking=void 0===i.blocking||i.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,i).then(async function({texture_nodes:t}){await r.createWorkers(),r.destroyFeatureSelection(),e.WorkerBroker.postMessage(r.workers,"self.clearFunctionStringCache");const n="object"==typeof r.config_source||r.hasSubscribersFor("load"),s=r.updateConfig({texture_nodes:t,serialize_funcs:n,normalize:!1,loading:!0,fade_in:!0});!0===i.blocking&&await s,r.freePreviousTextures(),r.updating--,r.initializing=null,r.initialized=!0,r.last_valid_config_source=r.config_source,r.last_valid_options={base_path:i.base_path,file_type:i.file_type},r.requestRedraw()}).catch(t=>{let i,r;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(i="yaml",r="Error parsing scene YAML"):r="Error initializing scene",this.trigger("error",{type:i,message:r,error:t,url:this.config_source}),r=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",r,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",r,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=r.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new Ai(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let i=this.config.sources[e];if(i.scripts)for(let e in i.scripts)-1===t.indexOf(i.scripts[e])&&t.push(i.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,i)=>t===e[i]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),r=[];this.workers=[];for(let n=0;n<this.num_workers;n++){let s=new Worker(i.workerURL);this.workers[n]=s,e.WorkerBroker.addWorker(s),e.log("debug",`Scene.makeWorkers: initializing worker ${n}`);let o=n;r.push(e.WorkerBroker.postMessage(s,"self.init",this.id,n,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${o}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(r).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,i){0===t&&0===i||(this.dirty=!0,this.view.setViewportSize(t,i),this.gl&&r.resize(this.gl,t,i,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,i=!!this.selection&&this.selection.hasPendingRequests();var r=!(!1===t&&!1===i||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",r),this.view.update(),!!r&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:i}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",r),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:i}){var r=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),i){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,this.canvas.width,this.canvas.height),r.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:i}={}){i=null==i||i,this.clearFrame();let r,n=0;const s=this.style_manager.getActiveBlendOrders();for(const{blend_order:o,styles:a}of s)for(let s=0;s<a.length;s++){let l=this.styles[a[s]];if(null==l)continue;if(l.blend!==r){let t=Object.assign({},e.Style.render_states[l.blend],{blend:i&&l.blend});this.setRenderState(t)}const u=i&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,o),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),n+=this.renderStyle(l.name,t,o),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let i=0;i<e.length;i++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-i,255),n+=this.renderStyle(l.name,t,o,e[i]);this.gl.disable(this.gl.STENCIL_TEST)}else n+=this.renderStyle(l.name,t,o)}else n+=this.renderStyle(l.name,t,o);r=l.blend}return n}renderStyle(e,t,i,r=null){let n,s=this.styles[e],o=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof r||e.proxy_level===r).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===i)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let i=0;i<u+1;i++)for(let[r,u]of l){let l=!0;if(!r.shouldProxyForStyle(e))continue;const h=u.filter(e=>e.variant.mesh_order===i);if(0!==h.length){if(!0===o&&(o=!1,n=this.setupStyle(s,t),!n))return 0;h.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(r,n)),s.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let i;try{if(i=e.getProgram(t),!i)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}i.use(),e.setup(),i.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(i);for(let e in this.lights)this.lights[e].setupProgram(i);return i}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:i,blend:r}={}){if(!this.initialized)return;let n=this.render_states;e=!1!==e&&n.defaults.depth_test,t=!1!==t&&n.defaults.depth_write,i=!1!==i&&n.defaults.culling,r=null!=r?r:n.defaults.blending;let s=this.gl;n.depth_test.set({depth_test:e}),n.depth_write.set({depth_write:t}),n.culling.set({cull:i,face:n.defaults.culling_face}),r?"opaque"===r?n.blending.set({blend:!1}):"overlay"===r||"inlay"===r||"translucent"===r?n.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===r?n.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===r&&n.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):n.blending.set({blend:!1})}getFeatureAt(t,{radius:i}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let r={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return i=i>0?{x:i/this.view.size.css.width,y:i/this.view.size.css.height}:null,this.selection.getFeatureAt(r,{radius:i}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:i=!0,group_by:r=null,visible:n=null,geometry:s=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const o=!0===(i="string"==typeof i?[i]:i)||Array.isArray(i)&&i.indexOf("$id")>-1,a=i&&(t=>{const r=Array.isArray(i)?e.sliceObject(t.properties,i):t.properties,n=o?t.id:null;return s?JSON.stringify({geometry:t.geometry,properties:r,id:n}):JSON.stringify({properties:r,id:n})}),l=(r=("string"==typeof r||Array.isArray(r))&&r)&&(t=>Array.isArray(r)?JSON.stringify(e.sliceObject(t,r)):t[r]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),h=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:n,geometry:s,tile_keys:u}),c=[],d={},f={};return h.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(d[t])return;d[t]=!0}if(l){const t=l(e.properties);f[t]=f[t]||[],f[t].push(e)}else c.push(e)})),l?f:c}rebuild({initial:t=!1,new_generation:i=!0,sources:r=null,serialize_funcs:n,profile:s=!1,fade_in:o=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:i,sources:r,serialize_funcs:n,profile:s,fade_in:o};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},s&&this.debug.profile("Scene.rebuild"),i){this.generation=++Si.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:n}),this.resetWorkerFeatureSelection(r),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!r||r.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:o})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{s&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:i,file_type:r}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(i||this.config_source):this.base_path=e.pathForURL(i),this.config_path=this.base_path;const{config:n,bundle:s,texture_nodes:o}=await pi.loadScene(this.config_source,{path:this.base_path,type:r});return this.config=n,this.config_bundle=s,{texture_nodes:o}}setDataSource(t,i){if(!t||!i||!i.type||!i.url&&!i.data)return void e.log("error","No name provided or not a valid config:",t,i);let r=null==this.config.sources[t],n=this.config.sources[t]=Object.assign({},i);return n.data&&"object"==typeof n.data&&(n.url=e.createObjectURL(new Blob([JSON.stringify(n.data)],{type:"application/json"})),delete n.data),r?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const i=[],r=Object.keys(this.sources);let n=0;for(var s in this.config.sources){const r=this.config.sources[s],o=this.sources[s];try{const t=Ei(Ei({},r),{},{name:s,id:n++});if(this.sources[s]=e.DataSource.create(t,this.sources),!this.sources[s])throw{}}catch(t){delete this.sources[s];const i=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${i}`,r),this.trigger("warning",{type:"sources",source:r,message:i})}(t||e.DataSource.tileLayoutChanged(this.sources[s],o))&&i.push(s)}r.forEach(e=>{this.config.sources[e]||(delete this.sources[e],i.push(e))}),i.length>0&&this.tile_manager.removeTiles(e=>i.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let i=this.config.lights[t];i.name=t.replace("-","_"),i.visible=!1!==i.visible,i.visible&&(this.lights[i.name]=e.Light.create(this.view,i))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,i=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!i.some((e,i)=>t[i]!==e)||(1===i[3]?this.canvas.style.backgroundColor=`rgba(${i.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...i))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:i=!0,serialize_funcs:r,texture_nodes:n={},normalize:s=!0,fade_in:o=!1}={}){this.generation=++Si.generation,this.updating++,this.config=pi.applyGlobalProperties(this.config),s&&pi.normalize(this.config,this.config_bundle,n),pi.hoistTextureNodes(this.config,this.config_bundle,n),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=i?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:r,fade_in:o},"object"==typeof i&&i)):this.syncConfigToWorker({serialize_funcs:r});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let i=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:i,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},pi.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),pi.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var Ri;Si.id=0,Si.generation=0;const zi={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Mi={leafletLayer:function(t){return function(t){if(void 0!==Ri)return new Ri(t);if(e.Thread.is_main){let i,r=t.leaflet||window.L,n=r.GridLayer?r.GridLayer:r.TileLayer,s=n===r.GridLayer?"1.x":"0.7.x",o={};return n===r.TileLayer&&(o._addTile=function(){},o._removeTile=function(){},o._reset=function(){n.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(o,{initialize(e){e.showDebug=!!e.showDebug,r.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=Si.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===Ri.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),n.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var i=t.getCenter();i.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(i),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){n.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,i=document.createElement("div");if(i.setAttribute("data-tile-key",t),i.style.width="256px",i.style.height="256px",this.options.showDebug){var r=document.createElement("div");r.textContent=t,r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.color="white",r.style.fontSize="16px",r.style.textOutline="1px #000000",r.style.padding="8px",i.appendChild(r),i.style.borderStyle="solid",i.style.borderColor="white",i.style.borderWidth="1px"}return i},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),r.Browser.chrome||r.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=r.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),r.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(n=function(e){e._moveEnd(!0),e.fire("viewreset")},s=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(o),o=setTimeout(function(){o=null,n.apply(e,t)},s)});zi.scrollWheelZoom._performZoom||(zi.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,r=e.getZoom();e._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,r+n>=this._map.getMaxZoom()?n=this._map.getMaxZoom()-r:r+n<=this._map.getMinZoom()&&(n=this._map.getMinZoom()-r),n&&("center"===e.options.scrollWheelZoom?i(t,e.getCenter(),r+n):i(t,this._lastMousePos,r+n),l(e))}else zi.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var n,s,o},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const n=function(t,n,s){e._stop();var o=e._zoom;n=r.latLng(n),s=void 0===s?o:s,s=Math.min(s,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=r.Util.requestAnimFrame(l,e),i(t,n,o+(s-o)*u)):i(t,n,s)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const i=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),zi.doubleClickZoom._onDoubleClick||(zi.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var i=this._map,r=i.getZoom(),s=i.options.zoomDelta,o=e.originalEvent.shiftKey?r-s:r+s;"center"===i.options.doubleClickZoom?n(t,i.getCenter(),o):n(t,i.containerPointToLatLng(e.containerPoint),o)}else zi.doubleClickZoom._onDoubleClick.call(this,e)},i&&e.doubleClickZoom.enable()}e._zoomAnimated&&(zi.map._animateZoom||(zi.map._animateZoom=e._animateZoom),e._animateZoom=function(e,i,s,o){this===t._map?(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=i,n(t,e,i)),setTimeout(r.Util.bind(this._onZoomTransitionEnd,this),250)):zi.map._animateZoom.call(this,e,i,s,o)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);r.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let i=Object.assign({},t,{leaflet_event:e});this._selection_events.click(i)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let i=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(i)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),i=function(e,t,i){var n=e._map,s=e.scene,o=n.getZoomScale(i),a=n.getSize().divideBy(2),l=(t instanceof r.Point?t:n.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/o),u=n.containerPointToLatLng(a.add(l));return s&&s.view.markUserInput(),n._move(u,i,{flyTo:!0})},"function"!=typeof(Ri=n.extend(o)).remove&&(Ri.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),Ri.layerBaseClass=n,Ri.leafletVersion=s,new Ri(t)}}(t)},debug:{log:e.log,yaml:hi,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Si,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Mi});try{i.debug.ESM=!0,i.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=i)}catch(e){}
2
2
  //# sourceMappingURL=tangram.min.js.map