@npm9912/v-map 0.1.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 (438) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -0
  3. package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
  4. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  5. package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
  6. package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
  7. package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
  8. package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
  9. package/dist/cjs/index-B1oGO1g-.js +10658 -0
  10. package/dist/cjs/index-B8LHqjyg.js +1765 -0
  11. package/dist/cjs/index-BIL4VsgP.js +310 -0
  12. package/dist/cjs/index-Blku2QY8.js +167 -0
  13. package/dist/cjs/index-CJvvX4yx.js +21 -0
  14. package/dist/cjs/index-CbVT-Con.js +699 -0
  15. package/dist/cjs/index-ISOEpMC3.js +20478 -0
  16. package/dist/cjs/index-JSwBbvGA.js +1621 -0
  17. package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
  18. package/dist/cjs/index.cjs.js +2 -0
  19. package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
  20. package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
  21. package/dist/cjs/loader.cjs.js +13 -0
  22. package/dist/cjs/main-dist-7TykwFci.js +2655 -0
  23. package/dist/cjs/messages-D7h4m8Tx.js +186 -0
  24. package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
  25. package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
  26. package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
  27. package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
  28. package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
  29. package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
  30. package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
  31. package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
  32. package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
  33. package/dist/cjs/v-map.cjs.js +25 -0
  34. package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
  35. package/dist/cjs/v-map_3.cjs.entry.js +12 -0
  36. package/dist/collection/collection-manifest.json +30 -0
  37. package/dist/collection/components/v-map/v-map.css +3 -0
  38. package/dist/collection/components/v-map/v-map.js +467 -0
  39. package/dist/collection/components/v-map/v-map.test.js +33 -0
  40. package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
  41. package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
  42. package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
  43. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
  44. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
  45. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
  46. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
  47. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
  48. package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
  49. package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
  50. package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
  51. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
  52. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
  53. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
  54. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
  55. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
  56. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
  57. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
  58. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
  59. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
  60. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
  61. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
  62. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
  63. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
  64. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
  65. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
  66. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
  67. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
  68. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
  69. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
  70. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
  71. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
  72. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
  73. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
  74. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
  75. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
  76. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
  77. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
  78. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
  79. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
  80. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
  81. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
  82. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
  83. package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
  84. package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
  85. package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
  86. package/dist/collection/components/v-map-style/v-map-style.css +38 -0
  87. package/dist/collection/components/v-map-style/v-map-style.js +492 -0
  88. package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
  89. package/dist/collection/index.js +1 -0
  90. package/dist/collection/layer/v-map-layer-helper.js +281 -0
  91. package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
  92. package/dist/collection/lib/cesium-loader.js +58 -0
  93. package/dist/collection/lib/ensure-importmap.js +12 -0
  94. package/dist/collection/lib/ensure-importmap.unit.js +57 -0
  95. package/dist/collection/lib/versions.gen.js +6 -0
  96. package/dist/collection/lib/vstyle.js +8 -0
  97. package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
  98. package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
  99. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
  100. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
  101. package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
  102. package/dist/collection/map-provider/cesium/i-layer.js +1 -0
  103. package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
  104. package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
  105. package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
  106. package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
  107. package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
  108. package/dist/collection/map-provider/deck/LayerModel.js +1 -0
  109. package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
  110. package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
  111. package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
  112. package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
  113. package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
  114. package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
  115. package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
  116. package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
  117. package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
  118. package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
  119. package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
  120. package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
  121. package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
  122. package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
  123. package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
  124. package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
  125. package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
  126. package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
  127. package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
  128. package/dist/collection/map-provider/provider-factory.js +44 -0
  129. package/dist/collection/map-provider/provider-factory.unit.js +66 -0
  130. package/dist/collection/testing/browser-test-utils.js +49 -0
  131. package/dist/collection/testing/e2e-testing.js +122 -0
  132. package/dist/collection/testing/e2e-utils.js +70 -0
  133. package/dist/collection/testing/geotiff-test-server.js +100 -0
  134. package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
  135. package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
  136. package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
  137. package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
  138. package/dist/collection/testing/mocks/geostyler-style.js +5 -0
  139. package/dist/collection/testing/setupTests.browser.js +1 -0
  140. package/dist/collection/testing/setupTests.stencil.js +20 -0
  141. package/dist/collection/testing/setupTests.vitest.js +59 -0
  142. package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
  143. package/dist/collection/testing/styleMock.js +1 -0
  144. package/dist/collection/types/color.js +1 -0
  145. package/dist/collection/types/cssmode.js +1 -0
  146. package/dist/collection/types/flavour.js +1 -0
  147. package/dist/collection/types/layerconfig.js +1 -0
  148. package/dist/collection/types/lonlat.js +1 -0
  149. package/dist/collection/types/mapinitoptions.js +1 -0
  150. package/dist/collection/types/mapprovider.js +1 -0
  151. package/dist/collection/types/provideroptions.js +1 -0
  152. package/dist/collection/types/styleconfig.js +19 -0
  153. package/dist/collection/types/styling.js +13 -0
  154. package/dist/collection/types/styling.unit.js +37 -0
  155. package/dist/collection/types/vmaplayer.js +1 -0
  156. package/dist/collection/utils/async-mutex.js +28 -0
  157. package/dist/collection/utils/diff.js +142 -0
  158. package/dist/collection/utils/diff.unit.js +59 -0
  159. package/dist/collection/utils/dom-env.js +43 -0
  160. package/dist/collection/utils/dom-env.unit.js +92 -0
  161. package/dist/collection/utils/events.js +8 -0
  162. package/dist/collection/utils/logger.js +183 -0
  163. package/dist/collection/utils/logger.unit.js +98 -0
  164. package/dist/collection/utils/messages.js +12 -0
  165. package/dist/collection/utils/spatial-utils.js +27 -0
  166. package/dist/collection/utils/spatial-utils.unit.js +24 -0
  167. package/dist/components/_commonjsHelpers.js +1 -0
  168. package/dist/components/cesium-provider.js +1 -0
  169. package/dist/components/deck-provider.js +1 -0
  170. package/dist/components/events.js +1 -0
  171. package/dist/components/geotiff-source.js +1 -0
  172. package/dist/components/geotiff.js +4 -0
  173. package/dist/components/index.browser.js +15 -0
  174. package/dist/components/index.d.ts +35 -0
  175. package/dist/components/index.js +1 -0
  176. package/dist/components/index2.js +1 -0
  177. package/dist/components/index3.js +1 -0
  178. package/dist/components/index4.js +1 -0
  179. package/dist/components/index5.js +1 -0
  180. package/dist/components/index6.js +1 -0
  181. package/dist/components/index7.js +1 -0
  182. package/dist/components/index8.js +7 -0
  183. package/dist/components/layer-extension.js +1 -0
  184. package/dist/components/leaflet-provider.js +1 -0
  185. package/dist/components/main-dist.js +1 -0
  186. package/dist/components/messages.js +1 -0
  187. package/dist/components/openlayers-provider.js +1 -0
  188. package/dist/components/polygon-layer.js +1 -0
  189. package/dist/components/scenegraph-layer.js +1 -0
  190. package/dist/components/styleconfig.js +1 -0
  191. package/dist/components/styling.js +1 -0
  192. package/dist/components/v-map-builder.d.ts +11 -0
  193. package/dist/components/v-map-builder.js +2 -0
  194. package/dist/components/v-map-layer-geojson.d.ts +11 -0
  195. package/dist/components/v-map-layer-geojson.js +1 -0
  196. package/dist/components/v-map-layer-geojson2.js +1 -0
  197. package/dist/components/v-map-layer-geotiff.d.ts +11 -0
  198. package/dist/components/v-map-layer-geotiff.js +1 -0
  199. package/dist/components/v-map-layer-geotiff2.js +1 -0
  200. package/dist/components/v-map-layer-google.d.ts +11 -0
  201. package/dist/components/v-map-layer-google.js +1 -0
  202. package/dist/components/v-map-layer-google2.js +1 -0
  203. package/dist/components/v-map-layer-helper.js +1 -0
  204. package/dist/components/v-map-layer-osm.d.ts +11 -0
  205. package/dist/components/v-map-layer-osm.js +1 -0
  206. package/dist/components/v-map-layer-osm2.js +1 -0
  207. package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
  208. package/dist/components/v-map-layer-scatterplot.js +1 -0
  209. package/dist/components/v-map-layer-scatterplot2.js +1 -0
  210. package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
  211. package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
  212. package/dist/components/v-map-layer-terrain.d.ts +11 -0
  213. package/dist/components/v-map-layer-terrain.js +1 -0
  214. package/dist/components/v-map-layer-terrain2.js +1 -0
  215. package/dist/components/v-map-layer-tile3d.d.ts +11 -0
  216. package/dist/components/v-map-layer-tile3d.js +1 -0
  217. package/dist/components/v-map-layer-tile3d2.js +1 -0
  218. package/dist/components/v-map-layer-wcs.d.ts +11 -0
  219. package/dist/components/v-map-layer-wcs.js +1 -0
  220. package/dist/components/v-map-layer-wcs2.js +1 -0
  221. package/dist/components/v-map-layer-wfs.d.ts +11 -0
  222. package/dist/components/v-map-layer-wfs.js +1 -0
  223. package/dist/components/v-map-layer-wfs2.js +1 -0
  224. package/dist/components/v-map-layer-wkt.d.ts +11 -0
  225. package/dist/components/v-map-layer-wkt.js +1 -0
  226. package/dist/components/v-map-layer-wkt2.js +1 -0
  227. package/dist/components/v-map-layer-wms.d.ts +11 -0
  228. package/dist/components/v-map-layer-wms.js +1 -0
  229. package/dist/components/v-map-layer-wms2.js +1 -0
  230. package/dist/components/v-map-layer-xyz.d.ts +11 -0
  231. package/dist/components/v-map-layer-xyz.js +1 -0
  232. package/dist/components/v-map-layer-xyz2.js +1 -0
  233. package/dist/components/v-map-layercontrol.d.ts +11 -0
  234. package/dist/components/v-map-layercontrol.js +1 -0
  235. package/dist/components/v-map-layergroup.d.ts +11 -0
  236. package/dist/components/v-map-layergroup.js +1 -0
  237. package/dist/components/v-map-layergroup2.js +1 -0
  238. package/dist/components/v-map-style.d.ts +11 -0
  239. package/dist/components/v-map-style.js +1 -0
  240. package/dist/components/v-map-style2.js +10 -0
  241. package/dist/components/v-map.d.ts +11 -0
  242. package/dist/components/v-map.js +1 -0
  243. package/dist/components/v-map2.js +1 -0
  244. package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
  245. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  246. package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
  247. package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
  248. package/dist/esm/geotiff-BEWxTIfH.js +45 -0
  249. package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
  250. package/dist/esm/index-B1zwA4IC.js +685 -0
  251. package/dist/esm/index-BBpiaTpT.js +165 -0
  252. package/dist/esm/index-BIEmlzCf.js +1697 -0
  253. package/dist/esm/index-BUHa4Jj0.js +307 -0
  254. package/dist/esm/index-DbSdn93t.js +20461 -0
  255. package/dist/esm/index-RpJarvr_.js +10656 -0
  256. package/dist/esm/index-jN06TXUp.js +14 -0
  257. package/dist/esm/index-jzneDarq.js +1613 -0
  258. package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
  259. package/dist/esm/index.js +1 -0
  260. package/dist/esm/layer-extension-CZXK5goK.js +63 -0
  261. package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
  262. package/dist/esm/loader.js +11 -0
  263. package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
  264. package/dist/esm/messages-CMKJzsgL.js +180 -0
  265. package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
  266. package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
  267. package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
  268. package/dist/esm/styleconfig-B-bAcABs.js +21 -0
  269. package/dist/esm/v-map-builder.entry.js +3784 -0
  270. package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
  271. package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
  272. package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
  273. package/dist/esm/v-map-layercontrol.entry.js +245 -0
  274. package/dist/esm/v-map.js +21 -0
  275. package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
  276. package/dist/esm/v-map_3.entry.js +4 -0
  277. package/dist/index.cjs.js +1 -0
  278. package/dist/index.js +1 -0
  279. package/dist/types/cesium-augment.d.ts +5 -0
  280. package/dist/types/components/v-map/v-map.d.ts +70 -0
  281. package/dist/types/components/v-map/v-map.test.d.ts +1 -0
  282. package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
  283. package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
  284. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
  285. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
  286. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
  287. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
  288. package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
  289. package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
  290. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
  291. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
  292. package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
  293. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
  294. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
  295. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
  296. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
  297. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
  298. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
  299. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
  300. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
  301. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
  302. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
  303. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
  304. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
  305. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
  306. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
  307. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
  308. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
  309. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
  310. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
  311. package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
  312. package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
  313. package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
  314. package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
  315. package/dist/types/components.d.ts +2391 -0
  316. package/dist/types/globals.d.ts +16 -0
  317. package/dist/types/index.d.ts +10 -0
  318. package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
  319. package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
  320. package/dist/types/leaflet-augment.d.ts +15 -0
  321. package/dist/types/lib/cesium-loader.d.ts +3 -0
  322. package/dist/types/lib/ensure-importmap.d.ts +3 -0
  323. package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
  324. package/dist/types/lib/versions.gen.d.ts +5 -0
  325. package/dist/types/lib/vstyle.d.ts +44 -0
  326. package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
  327. package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
  328. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
  329. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
  330. package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
  331. package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
  332. package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
  333. package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
  334. package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
  335. package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
  336. package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
  337. package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
  338. package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
  339. package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
  340. package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
  341. package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
  342. package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
  343. package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
  344. package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
  345. package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
  346. package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
  347. package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
  348. package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
  349. package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
  350. package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
  351. package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
  352. package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
  353. package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
  354. package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
  355. package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
  356. package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
  357. package/dist/types/map-provider/provider-factory.d.ts +12 -0
  358. package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
  359. package/dist/types/namespaces.d.ts +3 -0
  360. package/dist/types/ol-augment.d.ts +3 -0
  361. package/dist/types/ol-override.d.ts +7 -0
  362. package/dist/types/ol.d.ts +10 -0
  363. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  364. package/dist/types/testing/browser-test-utils.d.ts +6 -0
  365. package/dist/types/testing/e2e-testing.d.ts +5 -0
  366. package/dist/types/testing/e2e-utils.d.ts +4 -0
  367. package/dist/types/testing/geotiff-test-server.d.ts +5 -0
  368. package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
  369. package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
  370. package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
  371. package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
  372. package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
  373. package/dist/types/testing/setupTests.browser.d.ts +1 -0
  374. package/dist/types/testing/setupTests.stencil.d.ts +1 -0
  375. package/dist/types/testing/setupTests.vitest.d.ts +1 -0
  376. package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
  377. package/dist/types/types/color.d.ts +1 -0
  378. package/dist/types/types/cssmode.d.ts +1 -0
  379. package/dist/types/types/flavour.d.ts +1 -0
  380. package/dist/types/types/layerconfig.d.ts +207 -0
  381. package/dist/types/types/lonlat.d.ts +1 -0
  382. package/dist/types/types/mapinitoptions.d.ts +4 -0
  383. package/dist/types/types/mapprovider.d.ts +46 -0
  384. package/dist/types/types/provideroptions.d.ts +8 -0
  385. package/dist/types/types/styleconfig.d.ts +27 -0
  386. package/dist/types/types/styling.d.ts +24 -0
  387. package/dist/types/types/styling.unit.d.ts +1 -0
  388. package/dist/types/types/vmaplayer.d.ts +10 -0
  389. package/dist/types/utils/async-mutex.d.ts +7 -0
  390. package/dist/types/utils/diff.d.ts +64 -0
  391. package/dist/types/utils/diff.unit.d.ts +1 -0
  392. package/dist/types/utils/dom-env.d.ts +5 -0
  393. package/dist/types/utils/dom-env.unit.d.ts +1 -0
  394. package/dist/types/utils/events.d.ts +29 -0
  395. package/dist/types/utils/logger.d.ts +47 -0
  396. package/dist/types/utils/logger.unit.d.ts +1 -0
  397. package/dist/types/utils/messages.d.ts +12 -0
  398. package/dist/types/utils/spatial-utils.d.ts +6 -0
  399. package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
  400. package/dist/types/versions.d.ts +7 -0
  401. package/dist/v-map/index.esm.js +0 -0
  402. package/dist/v-map/p--vVleK-M.js +1 -0
  403. package/dist/v-map/p-09d10db0.entry.js +1 -0
  404. package/dist/v-map/p-5eba6058.entry.js +10 -0
  405. package/dist/v-map/p-6b102336.entry.js +1 -0
  406. package/dist/v-map/p-B-bAcABs.js +1 -0
  407. package/dist/v-map/p-BBpiaTpT.js +1 -0
  408. package/dist/v-map/p-BdijL4Av.js +1 -0
  409. package/dist/v-map/p-Be3r33VF.js +4 -0
  410. package/dist/v-map/p-BeFu0ap4.js +1 -0
  411. package/dist/v-map/p-BxFJezdK.js +1 -0
  412. package/dist/v-map/p-CMKJzsgL.js +1 -0
  413. package/dist/v-map/p-CXfA_q8m.js +1 -0
  414. package/dist/v-map/p-CZqY0yW4.js +1 -0
  415. package/dist/v-map/p-CafTHT9i.js +1 -0
  416. package/dist/v-map/p-DCTHyf58.js +1 -0
  417. package/dist/v-map/p-DQuL1Twl.js +1 -0
  418. package/dist/v-map/p-DR9McdNX.js +1 -0
  419. package/dist/v-map/p-Dckgonw8.js +1 -0
  420. package/dist/v-map/p-DhQAXuA7.js +15 -0
  421. package/dist/v-map/p-DmICdG34.js +7 -0
  422. package/dist/v-map/p-DrOQ9V4h.js +1 -0
  423. package/dist/v-map/p-DvHXtWUg.js +1 -0
  424. package/dist/v-map/p-E-ZsRS8r.js +1 -0
  425. package/dist/v-map/p-MyTSFnEk.js +1 -0
  426. package/dist/v-map/p-RpJarvr_.js +1 -0
  427. package/dist/v-map/p-WaMDUuAz.js +1 -0
  428. package/dist/v-map/p-aa410e64.entry.js +2 -0
  429. package/dist/v-map/p-c21c93fe.entry.js +1 -0
  430. package/dist/v-map/p-jzneDarq.js +2 -0
  431. package/dist/v-map/p-uiIP-taz.js +1 -0
  432. package/dist/v-map/v-map.esm.js +1 -0
  433. package/loader/cdn.js +1 -0
  434. package/loader/index.cjs.js +1 -0
  435. package/loader/index.d.ts +24 -0
  436. package/loader/index.es2017.js +1 -0
  437. package/loader/index.js +2 -0
  438. package/package.json +193 -0
@@ -0,0 +1,3784 @@
1
+ import { r as registerInstance, c as createEvent, g as getElement, h } from './index-jzneDarq.js';
2
+ import { l as log, M as MESSAGES, V as VMapEvents } from './messages-CMKJzsgL.js';
3
+
4
+ /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
5
+ function isNothing(subject) {
6
+ return (typeof subject === 'undefined') || (subject === null);
7
+ }
8
+
9
+
10
+ function isObject(subject) {
11
+ return (typeof subject === 'object') && (subject !== null);
12
+ }
13
+
14
+
15
+ function toArray(sequence) {
16
+ if (Array.isArray(sequence)) return sequence;
17
+ else if (isNothing(sequence)) return [];
18
+
19
+ return [ sequence ];
20
+ }
21
+
22
+
23
+ function extend(target, source) {
24
+ var index, length, key, sourceKeys;
25
+
26
+ if (source) {
27
+ sourceKeys = Object.keys(source);
28
+
29
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
30
+ key = sourceKeys[index];
31
+ target[key] = source[key];
32
+ }
33
+ }
34
+
35
+ return target;
36
+ }
37
+
38
+
39
+ function repeat(string, count) {
40
+ var result = '', cycle;
41
+
42
+ for (cycle = 0; cycle < count; cycle += 1) {
43
+ result += string;
44
+ }
45
+
46
+ return result;
47
+ }
48
+
49
+
50
+ function isNegativeZero(number) {
51
+ return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
52
+ }
53
+
54
+
55
+ var isNothing_1 = isNothing;
56
+ var isObject_1 = isObject;
57
+ var toArray_1 = toArray;
58
+ var repeat_1 = repeat;
59
+ var isNegativeZero_1 = isNegativeZero;
60
+ var extend_1 = extend;
61
+
62
+ var common = {
63
+ isNothing: isNothing_1,
64
+ isObject: isObject_1,
65
+ toArray: toArray_1,
66
+ repeat: repeat_1,
67
+ isNegativeZero: isNegativeZero_1,
68
+ extend: extend_1
69
+ };
70
+
71
+ // YAML error class. http://stackoverflow.com/questions/8458984
72
+
73
+
74
+ function formatError(exception, compact) {
75
+ var where = '', message = exception.reason || '(unknown reason)';
76
+
77
+ if (!exception.mark) return message;
78
+
79
+ if (exception.mark.name) {
80
+ where += 'in "' + exception.mark.name + '" ';
81
+ }
82
+
83
+ where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
84
+
85
+ if (!compact && exception.mark.snippet) {
86
+ where += '\n\n' + exception.mark.snippet;
87
+ }
88
+
89
+ return message + ' ' + where;
90
+ }
91
+
92
+
93
+ function YAMLException$1(reason, mark) {
94
+ // Super constructor
95
+ Error.call(this);
96
+
97
+ this.name = 'YAMLException';
98
+ this.reason = reason;
99
+ this.mark = mark;
100
+ this.message = formatError(this, false);
101
+
102
+ // Include stack trace in error object
103
+ if (Error.captureStackTrace) {
104
+ // Chrome and NodeJS
105
+ Error.captureStackTrace(this, this.constructor);
106
+ } else {
107
+ // FF, IE 10+ and Safari 6+. Fallback for others
108
+ this.stack = (new Error()).stack || '';
109
+ }
110
+ }
111
+
112
+
113
+ // Inherit from Error
114
+ YAMLException$1.prototype = Object.create(Error.prototype);
115
+ YAMLException$1.prototype.constructor = YAMLException$1;
116
+
117
+
118
+ YAMLException$1.prototype.toString = function toString(compact) {
119
+ return this.name + ': ' + formatError(this, compact);
120
+ };
121
+
122
+
123
+ var exception = YAMLException$1;
124
+
125
+ // get snippet for a single line, respecting maxLength
126
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
127
+ var head = '';
128
+ var tail = '';
129
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
130
+
131
+ if (position - lineStart > maxHalfLength) {
132
+ head = ' ... ';
133
+ lineStart = position - maxHalfLength + head.length;
134
+ }
135
+
136
+ if (lineEnd - position > maxHalfLength) {
137
+ tail = ' ...';
138
+ lineEnd = position + maxHalfLength - tail.length;
139
+ }
140
+
141
+ return {
142
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
143
+ pos: position - lineStart + head.length // relative position
144
+ };
145
+ }
146
+
147
+
148
+ function padStart(string, max) {
149
+ return common.repeat(' ', max - string.length) + string;
150
+ }
151
+
152
+
153
+ function makeSnippet(mark, options) {
154
+ options = Object.create(options || null);
155
+
156
+ if (!mark.buffer) return null;
157
+
158
+ if (!options.maxLength) options.maxLength = 79;
159
+ if (typeof options.indent !== 'number') options.indent = 1;
160
+ if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
161
+ if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
162
+
163
+ var re = /\r?\n|\r|\0/g;
164
+ var lineStarts = [ 0 ];
165
+ var lineEnds = [];
166
+ var match;
167
+ var foundLineNo = -1;
168
+
169
+ while ((match = re.exec(mark.buffer))) {
170
+ lineEnds.push(match.index);
171
+ lineStarts.push(match.index + match[0].length);
172
+
173
+ if (mark.position <= match.index && foundLineNo < 0) {
174
+ foundLineNo = lineStarts.length - 2;
175
+ }
176
+ }
177
+
178
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
179
+
180
+ var result = '', i, line;
181
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
182
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
183
+
184
+ for (i = 1; i <= options.linesBefore; i++) {
185
+ if (foundLineNo - i < 0) break;
186
+ line = getLine(
187
+ mark.buffer,
188
+ lineStarts[foundLineNo - i],
189
+ lineEnds[foundLineNo - i],
190
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
191
+ maxLineLength
192
+ );
193
+ result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
194
+ ' | ' + line.str + '\n' + result;
195
+ }
196
+
197
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
198
+ result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
199
+ ' | ' + line.str + '\n';
200
+ result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
201
+
202
+ for (i = 1; i <= options.linesAfter; i++) {
203
+ if (foundLineNo + i >= lineEnds.length) break;
204
+ line = getLine(
205
+ mark.buffer,
206
+ lineStarts[foundLineNo + i],
207
+ lineEnds[foundLineNo + i],
208
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
209
+ maxLineLength
210
+ );
211
+ result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
212
+ ' | ' + line.str + '\n';
213
+ }
214
+
215
+ return result.replace(/\n$/, '');
216
+ }
217
+
218
+
219
+ var snippet = makeSnippet;
220
+
221
+ var TYPE_CONSTRUCTOR_OPTIONS = [
222
+ 'kind',
223
+ 'multi',
224
+ 'resolve',
225
+ 'construct',
226
+ 'instanceOf',
227
+ 'predicate',
228
+ 'represent',
229
+ 'representName',
230
+ 'defaultStyle',
231
+ 'styleAliases'
232
+ ];
233
+
234
+ var YAML_NODE_KINDS = [
235
+ 'scalar',
236
+ 'sequence',
237
+ 'mapping'
238
+ ];
239
+
240
+ function compileStyleAliases(map) {
241
+ var result = {};
242
+
243
+ if (map !== null) {
244
+ Object.keys(map).forEach(function (style) {
245
+ map[style].forEach(function (alias) {
246
+ result[String(alias)] = style;
247
+ });
248
+ });
249
+ }
250
+
251
+ return result;
252
+ }
253
+
254
+ function Type$1(tag, options) {
255
+ options = options || {};
256
+
257
+ Object.keys(options).forEach(function (name) {
258
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
259
+ throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
260
+ }
261
+ });
262
+
263
+ // TODO: Add tag format check.
264
+ this.options = options; // keep original options in case user wants to extend this type later
265
+ this.tag = tag;
266
+ this.kind = options['kind'] || null;
267
+ this.resolve = options['resolve'] || function () { return true; };
268
+ this.construct = options['construct'] || function (data) { return data; };
269
+ this.instanceOf = options['instanceOf'] || null;
270
+ this.predicate = options['predicate'] || null;
271
+ this.represent = options['represent'] || null;
272
+ this.representName = options['representName'] || null;
273
+ this.defaultStyle = options['defaultStyle'] || null;
274
+ this.multi = options['multi'] || false;
275
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
276
+
277
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
278
+ throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
279
+ }
280
+ }
281
+
282
+ var type = Type$1;
283
+
284
+ /*eslint-disable max-len*/
285
+
286
+
287
+
288
+
289
+
290
+ function compileList(schema, name) {
291
+ var result = [];
292
+
293
+ schema[name].forEach(function (currentType) {
294
+ var newIndex = result.length;
295
+
296
+ result.forEach(function (previousType, previousIndex) {
297
+ if (previousType.tag === currentType.tag &&
298
+ previousType.kind === currentType.kind &&
299
+ previousType.multi === currentType.multi) {
300
+
301
+ newIndex = previousIndex;
302
+ }
303
+ });
304
+
305
+ result[newIndex] = currentType;
306
+ });
307
+
308
+ return result;
309
+ }
310
+
311
+
312
+ function compileMap(/* lists... */) {
313
+ var result = {
314
+ scalar: {},
315
+ sequence: {},
316
+ mapping: {},
317
+ fallback: {},
318
+ multi: {
319
+ scalar: [],
320
+ sequence: [],
321
+ mapping: [],
322
+ fallback: []
323
+ }
324
+ }, index, length;
325
+
326
+ function collectType(type) {
327
+ if (type.multi) {
328
+ result.multi[type.kind].push(type);
329
+ result.multi['fallback'].push(type);
330
+ } else {
331
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
332
+ }
333
+ }
334
+
335
+ for (index = 0, length = arguments.length; index < length; index += 1) {
336
+ arguments[index].forEach(collectType);
337
+ }
338
+ return result;
339
+ }
340
+
341
+
342
+ function Schema$1(definition) {
343
+ return this.extend(definition);
344
+ }
345
+
346
+
347
+ Schema$1.prototype.extend = function extend(definition) {
348
+ var implicit = [];
349
+ var explicit = [];
350
+
351
+ if (definition instanceof type) {
352
+ // Schema.extend(type)
353
+ explicit.push(definition);
354
+
355
+ } else if (Array.isArray(definition)) {
356
+ // Schema.extend([ type1, type2, ... ])
357
+ explicit = explicit.concat(definition);
358
+
359
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
360
+ // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
361
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
362
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
363
+
364
+ } else {
365
+ throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
366
+ 'or a schema definition ({ implicit: [...], explicit: [...] })');
367
+ }
368
+
369
+ implicit.forEach(function (type$1) {
370
+ if (!(type$1 instanceof type)) {
371
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
372
+ }
373
+
374
+ if (type$1.loadKind && type$1.loadKind !== 'scalar') {
375
+ throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
376
+ }
377
+
378
+ if (type$1.multi) {
379
+ throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
380
+ }
381
+ });
382
+
383
+ explicit.forEach(function (type$1) {
384
+ if (!(type$1 instanceof type)) {
385
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
386
+ }
387
+ });
388
+
389
+ var result = Object.create(Schema$1.prototype);
390
+
391
+ result.implicit = (this.implicit || []).concat(implicit);
392
+ result.explicit = (this.explicit || []).concat(explicit);
393
+
394
+ result.compiledImplicit = compileList(result, 'implicit');
395
+ result.compiledExplicit = compileList(result, 'explicit');
396
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
397
+
398
+ return result;
399
+ };
400
+
401
+
402
+ var schema = Schema$1;
403
+
404
+ var str = new type('tag:yaml.org,2002:str', {
405
+ kind: 'scalar',
406
+ construct: function (data) { return data !== null ? data : ''; }
407
+ });
408
+
409
+ var seq = new type('tag:yaml.org,2002:seq', {
410
+ kind: 'sequence',
411
+ construct: function (data) { return data !== null ? data : []; }
412
+ });
413
+
414
+ var map = new type('tag:yaml.org,2002:map', {
415
+ kind: 'mapping',
416
+ construct: function (data) { return data !== null ? data : {}; }
417
+ });
418
+
419
+ var failsafe = new schema({
420
+ explicit: [
421
+ str,
422
+ seq,
423
+ map
424
+ ]
425
+ });
426
+
427
+ function resolveYamlNull(data) {
428
+ if (data === null) return true;
429
+
430
+ var max = data.length;
431
+
432
+ return (max === 1 && data === '~') ||
433
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
434
+ }
435
+
436
+ function constructYamlNull() {
437
+ return null;
438
+ }
439
+
440
+ function isNull(object) {
441
+ return object === null;
442
+ }
443
+
444
+ var _null = new type('tag:yaml.org,2002:null', {
445
+ kind: 'scalar',
446
+ resolve: resolveYamlNull,
447
+ construct: constructYamlNull,
448
+ predicate: isNull,
449
+ represent: {
450
+ canonical: function () { return '~'; },
451
+ lowercase: function () { return 'null'; },
452
+ uppercase: function () { return 'NULL'; },
453
+ camelcase: function () { return 'Null'; },
454
+ empty: function () { return ''; }
455
+ },
456
+ defaultStyle: 'lowercase'
457
+ });
458
+
459
+ function resolveYamlBoolean(data) {
460
+ if (data === null) return false;
461
+
462
+ var max = data.length;
463
+
464
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
465
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
466
+ }
467
+
468
+ function constructYamlBoolean(data) {
469
+ return data === 'true' ||
470
+ data === 'True' ||
471
+ data === 'TRUE';
472
+ }
473
+
474
+ function isBoolean(object) {
475
+ return Object.prototype.toString.call(object) === '[object Boolean]';
476
+ }
477
+
478
+ var bool = new type('tag:yaml.org,2002:bool', {
479
+ kind: 'scalar',
480
+ resolve: resolveYamlBoolean,
481
+ construct: constructYamlBoolean,
482
+ predicate: isBoolean,
483
+ represent: {
484
+ lowercase: function (object) { return object ? 'true' : 'false'; },
485
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
486
+ camelcase: function (object) { return object ? 'True' : 'False'; }
487
+ },
488
+ defaultStyle: 'lowercase'
489
+ });
490
+
491
+ function isHexCode(c) {
492
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
493
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
494
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
495
+ }
496
+
497
+ function isOctCode(c) {
498
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
499
+ }
500
+
501
+ function isDecCode(c) {
502
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
503
+ }
504
+
505
+ function resolveYamlInteger(data) {
506
+ if (data === null) return false;
507
+
508
+ var max = data.length,
509
+ index = 0,
510
+ hasDigits = false,
511
+ ch;
512
+
513
+ if (!max) return false;
514
+
515
+ ch = data[index];
516
+
517
+ // sign
518
+ if (ch === '-' || ch === '+') {
519
+ ch = data[++index];
520
+ }
521
+
522
+ if (ch === '0') {
523
+ // 0
524
+ if (index + 1 === max) return true;
525
+ ch = data[++index];
526
+
527
+ // base 2, base 8, base 16
528
+
529
+ if (ch === 'b') {
530
+ // base 2
531
+ index++;
532
+
533
+ for (; index < max; index++) {
534
+ ch = data[index];
535
+ if (ch === '_') continue;
536
+ if (ch !== '0' && ch !== '1') return false;
537
+ hasDigits = true;
538
+ }
539
+ return hasDigits && ch !== '_';
540
+ }
541
+
542
+
543
+ if (ch === 'x') {
544
+ // base 16
545
+ index++;
546
+
547
+ for (; index < max; index++) {
548
+ ch = data[index];
549
+ if (ch === '_') continue;
550
+ if (!isHexCode(data.charCodeAt(index))) return false;
551
+ hasDigits = true;
552
+ }
553
+ return hasDigits && ch !== '_';
554
+ }
555
+
556
+
557
+ if (ch === 'o') {
558
+ // base 8
559
+ index++;
560
+
561
+ for (; index < max; index++) {
562
+ ch = data[index];
563
+ if (ch === '_') continue;
564
+ if (!isOctCode(data.charCodeAt(index))) return false;
565
+ hasDigits = true;
566
+ }
567
+ return hasDigits && ch !== '_';
568
+ }
569
+ }
570
+
571
+ // base 10 (except 0)
572
+
573
+ // value should not start with `_`;
574
+ if (ch === '_') return false;
575
+
576
+ for (; index < max; index++) {
577
+ ch = data[index];
578
+ if (ch === '_') continue;
579
+ if (!isDecCode(data.charCodeAt(index))) {
580
+ return false;
581
+ }
582
+ hasDigits = true;
583
+ }
584
+
585
+ // Should have digits and should not end with `_`
586
+ if (!hasDigits || ch === '_') return false;
587
+
588
+ return true;
589
+ }
590
+
591
+ function constructYamlInteger(data) {
592
+ var value = data, sign = 1, ch;
593
+
594
+ if (value.indexOf('_') !== -1) {
595
+ value = value.replace(/_/g, '');
596
+ }
597
+
598
+ ch = value[0];
599
+
600
+ if (ch === '-' || ch === '+') {
601
+ if (ch === '-') sign = -1;
602
+ value = value.slice(1);
603
+ ch = value[0];
604
+ }
605
+
606
+ if (value === '0') return 0;
607
+
608
+ if (ch === '0') {
609
+ if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
610
+ if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
611
+ if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
612
+ }
613
+
614
+ return sign * parseInt(value, 10);
615
+ }
616
+
617
+ function isInteger(object) {
618
+ return (Object.prototype.toString.call(object)) === '[object Number]' &&
619
+ (object % 1 === 0 && !common.isNegativeZero(object));
620
+ }
621
+
622
+ var int = new type('tag:yaml.org,2002:int', {
623
+ kind: 'scalar',
624
+ resolve: resolveYamlInteger,
625
+ construct: constructYamlInteger,
626
+ predicate: isInteger,
627
+ represent: {
628
+ binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
629
+ octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
630
+ decimal: function (obj) { return obj.toString(10); },
631
+ /* eslint-disable max-len */
632
+ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
633
+ },
634
+ defaultStyle: 'decimal',
635
+ styleAliases: {
636
+ binary: [ 2, 'bin' ],
637
+ octal: [ 8, 'oct' ],
638
+ decimal: [ 10, 'dec' ],
639
+ hexadecimal: [ 16, 'hex' ]
640
+ }
641
+ });
642
+
643
+ var YAML_FLOAT_PATTERN = new RegExp(
644
+ // 2.5e4, 2.5 and integers
645
+ '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
646
+ // .2e4, .2
647
+ // special case, seems not from spec
648
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
649
+ // .inf
650
+ '|[-+]?\\.(?:inf|Inf|INF)' +
651
+ // .nan
652
+ '|\\.(?:nan|NaN|NAN))$');
653
+
654
+ function resolveYamlFloat(data) {
655
+ if (data === null) return false;
656
+
657
+ if (!YAML_FLOAT_PATTERN.test(data) ||
658
+ // Quick hack to not allow integers end with `_`
659
+ // Probably should update regexp & check speed
660
+ data[data.length - 1] === '_') {
661
+ return false;
662
+ }
663
+
664
+ return true;
665
+ }
666
+
667
+ function constructYamlFloat(data) {
668
+ var value, sign;
669
+
670
+ value = data.replace(/_/g, '').toLowerCase();
671
+ sign = value[0] === '-' ? -1 : 1;
672
+
673
+ if ('+-'.indexOf(value[0]) >= 0) {
674
+ value = value.slice(1);
675
+ }
676
+
677
+ if (value === '.inf') {
678
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
679
+
680
+ } else if (value === '.nan') {
681
+ return NaN;
682
+ }
683
+ return sign * parseFloat(value, 10);
684
+ }
685
+
686
+
687
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
688
+
689
+ function representYamlFloat(object, style) {
690
+ var res;
691
+
692
+ if (isNaN(object)) {
693
+ switch (style) {
694
+ case 'lowercase': return '.nan';
695
+ case 'uppercase': return '.NAN';
696
+ case 'camelcase': return '.NaN';
697
+ }
698
+ } else if (Number.POSITIVE_INFINITY === object) {
699
+ switch (style) {
700
+ case 'lowercase': return '.inf';
701
+ case 'uppercase': return '.INF';
702
+ case 'camelcase': return '.Inf';
703
+ }
704
+ } else if (Number.NEGATIVE_INFINITY === object) {
705
+ switch (style) {
706
+ case 'lowercase': return '-.inf';
707
+ case 'uppercase': return '-.INF';
708
+ case 'camelcase': return '-.Inf';
709
+ }
710
+ } else if (common.isNegativeZero(object)) {
711
+ return '-0.0';
712
+ }
713
+
714
+ res = object.toString(10);
715
+
716
+ // JS stringifier can build scientific format without dots: 5e-100,
717
+ // while YAML requres dot: 5.e-100. Fix it with simple hack
718
+
719
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
720
+ }
721
+
722
+ function isFloat(object) {
723
+ return (Object.prototype.toString.call(object) === '[object Number]') &&
724
+ (object % 1 !== 0 || common.isNegativeZero(object));
725
+ }
726
+
727
+ var float = new type('tag:yaml.org,2002:float', {
728
+ kind: 'scalar',
729
+ resolve: resolveYamlFloat,
730
+ construct: constructYamlFloat,
731
+ predicate: isFloat,
732
+ represent: representYamlFloat,
733
+ defaultStyle: 'lowercase'
734
+ });
735
+
736
+ var json = failsafe.extend({
737
+ implicit: [
738
+ _null,
739
+ bool,
740
+ int,
741
+ float
742
+ ]
743
+ });
744
+
745
+ var core = json;
746
+
747
+ var YAML_DATE_REGEXP = new RegExp(
748
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
749
+ '-([0-9][0-9])' + // [2] month
750
+ '-([0-9][0-9])$'); // [3] day
751
+
752
+ var YAML_TIMESTAMP_REGEXP = new RegExp(
753
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
754
+ '-([0-9][0-9]?)' + // [2] month
755
+ '-([0-9][0-9]?)' + // [3] day
756
+ '(?:[Tt]|[ \\t]+)' + // ...
757
+ '([0-9][0-9]?)' + // [4] hour
758
+ ':([0-9][0-9])' + // [5] minute
759
+ ':([0-9][0-9])' + // [6] second
760
+ '(?:\\.([0-9]*))?' + // [7] fraction
761
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
762
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
763
+
764
+ function resolveYamlTimestamp(data) {
765
+ if (data === null) return false;
766
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
767
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
768
+ return false;
769
+ }
770
+
771
+ function constructYamlTimestamp(data) {
772
+ var match, year, month, day, hour, minute, second, fraction = 0,
773
+ delta = null, tz_hour, tz_minute, date;
774
+
775
+ match = YAML_DATE_REGEXP.exec(data);
776
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
777
+
778
+ if (match === null) throw new Error('Date resolve error');
779
+
780
+ // match: [1] year [2] month [3] day
781
+
782
+ year = +(match[1]);
783
+ month = +(match[2]) - 1; // JS month starts with 0
784
+ day = +(match[3]);
785
+
786
+ if (!match[4]) { // no hour
787
+ return new Date(Date.UTC(year, month, day));
788
+ }
789
+
790
+ // match: [4] hour [5] minute [6] second [7] fraction
791
+
792
+ hour = +(match[4]);
793
+ minute = +(match[5]);
794
+ second = +(match[6]);
795
+
796
+ if (match[7]) {
797
+ fraction = match[7].slice(0, 3);
798
+ while (fraction.length < 3) { // milli-seconds
799
+ fraction += '0';
800
+ }
801
+ fraction = +fraction;
802
+ }
803
+
804
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
805
+
806
+ if (match[9]) {
807
+ tz_hour = +(match[10]);
808
+ tz_minute = +(match[11] || 0);
809
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
810
+ if (match[9] === '-') delta = -delta;
811
+ }
812
+
813
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
814
+
815
+ if (delta) date.setTime(date.getTime() - delta);
816
+
817
+ return date;
818
+ }
819
+
820
+ function representYamlTimestamp(object /*, style*/) {
821
+ return object.toISOString();
822
+ }
823
+
824
+ var timestamp = new type('tag:yaml.org,2002:timestamp', {
825
+ kind: 'scalar',
826
+ resolve: resolveYamlTimestamp,
827
+ construct: constructYamlTimestamp,
828
+ instanceOf: Date,
829
+ represent: representYamlTimestamp
830
+ });
831
+
832
+ function resolveYamlMerge(data) {
833
+ return data === '<<' || data === null;
834
+ }
835
+
836
+ var merge = new type('tag:yaml.org,2002:merge', {
837
+ kind: 'scalar',
838
+ resolve: resolveYamlMerge
839
+ });
840
+
841
+ /*eslint-disable no-bitwise*/
842
+
843
+
844
+
845
+
846
+
847
+ // [ 64, 65, 66 ] -> [ padding, CR, LF ]
848
+ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
849
+
850
+
851
+ function resolveYamlBinary(data) {
852
+ if (data === null) return false;
853
+
854
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
855
+
856
+ // Convert one by one.
857
+ for (idx = 0; idx < max; idx++) {
858
+ code = map.indexOf(data.charAt(idx));
859
+
860
+ // Skip CR/LF
861
+ if (code > 64) continue;
862
+
863
+ // Fail on illegal characters
864
+ if (code < 0) return false;
865
+
866
+ bitlen += 6;
867
+ }
868
+
869
+ // If there are any bits left, source was corrupted
870
+ return (bitlen % 8) === 0;
871
+ }
872
+
873
+ function constructYamlBinary(data) {
874
+ var idx, tailbits,
875
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
876
+ max = input.length,
877
+ map = BASE64_MAP,
878
+ bits = 0,
879
+ result = [];
880
+
881
+ // Collect by 6*4 bits (3 bytes)
882
+
883
+ for (idx = 0; idx < max; idx++) {
884
+ if ((idx % 4 === 0) && idx) {
885
+ result.push((bits >> 16) & 0xFF);
886
+ result.push((bits >> 8) & 0xFF);
887
+ result.push(bits & 0xFF);
888
+ }
889
+
890
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
891
+ }
892
+
893
+ // Dump tail
894
+
895
+ tailbits = (max % 4) * 6;
896
+
897
+ if (tailbits === 0) {
898
+ result.push((bits >> 16) & 0xFF);
899
+ result.push((bits >> 8) & 0xFF);
900
+ result.push(bits & 0xFF);
901
+ } else if (tailbits === 18) {
902
+ result.push((bits >> 10) & 0xFF);
903
+ result.push((bits >> 2) & 0xFF);
904
+ } else if (tailbits === 12) {
905
+ result.push((bits >> 4) & 0xFF);
906
+ }
907
+
908
+ return new Uint8Array(result);
909
+ }
910
+
911
+ function representYamlBinary(object /*, style*/) {
912
+ var result = '', bits = 0, idx, tail,
913
+ max = object.length,
914
+ map = BASE64_MAP;
915
+
916
+ // Convert every three bytes to 4 ASCII characters.
917
+
918
+ for (idx = 0; idx < max; idx++) {
919
+ if ((idx % 3 === 0) && idx) {
920
+ result += map[(bits >> 18) & 0x3F];
921
+ result += map[(bits >> 12) & 0x3F];
922
+ result += map[(bits >> 6) & 0x3F];
923
+ result += map[bits & 0x3F];
924
+ }
925
+
926
+ bits = (bits << 8) + object[idx];
927
+ }
928
+
929
+ // Dump tail
930
+
931
+ tail = max % 3;
932
+
933
+ if (tail === 0) {
934
+ result += map[(bits >> 18) & 0x3F];
935
+ result += map[(bits >> 12) & 0x3F];
936
+ result += map[(bits >> 6) & 0x3F];
937
+ result += map[bits & 0x3F];
938
+ } else if (tail === 2) {
939
+ result += map[(bits >> 10) & 0x3F];
940
+ result += map[(bits >> 4) & 0x3F];
941
+ result += map[(bits << 2) & 0x3F];
942
+ result += map[64];
943
+ } else if (tail === 1) {
944
+ result += map[(bits >> 2) & 0x3F];
945
+ result += map[(bits << 4) & 0x3F];
946
+ result += map[64];
947
+ result += map[64];
948
+ }
949
+
950
+ return result;
951
+ }
952
+
953
+ function isBinary(obj) {
954
+ return Object.prototype.toString.call(obj) === '[object Uint8Array]';
955
+ }
956
+
957
+ var binary = new type('tag:yaml.org,2002:binary', {
958
+ kind: 'scalar',
959
+ resolve: resolveYamlBinary,
960
+ construct: constructYamlBinary,
961
+ predicate: isBinary,
962
+ represent: representYamlBinary
963
+ });
964
+
965
+ var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
966
+ var _toString$2 = Object.prototype.toString;
967
+
968
+ function resolveYamlOmap(data) {
969
+ if (data === null) return true;
970
+
971
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
972
+ object = data;
973
+
974
+ for (index = 0, length = object.length; index < length; index += 1) {
975
+ pair = object[index];
976
+ pairHasKey = false;
977
+
978
+ if (_toString$2.call(pair) !== '[object Object]') return false;
979
+
980
+ for (pairKey in pair) {
981
+ if (_hasOwnProperty$3.call(pair, pairKey)) {
982
+ if (!pairHasKey) pairHasKey = true;
983
+ else return false;
984
+ }
985
+ }
986
+
987
+ if (!pairHasKey) return false;
988
+
989
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
990
+ else return false;
991
+ }
992
+
993
+ return true;
994
+ }
995
+
996
+ function constructYamlOmap(data) {
997
+ return data !== null ? data : [];
998
+ }
999
+
1000
+ var omap = new type('tag:yaml.org,2002:omap', {
1001
+ kind: 'sequence',
1002
+ resolve: resolveYamlOmap,
1003
+ construct: constructYamlOmap
1004
+ });
1005
+
1006
+ var _toString$1 = Object.prototype.toString;
1007
+
1008
+ function resolveYamlPairs(data) {
1009
+ if (data === null) return true;
1010
+
1011
+ var index, length, pair, keys, result,
1012
+ object = data;
1013
+
1014
+ result = new Array(object.length);
1015
+
1016
+ for (index = 0, length = object.length; index < length; index += 1) {
1017
+ pair = object[index];
1018
+
1019
+ if (_toString$1.call(pair) !== '[object Object]') return false;
1020
+
1021
+ keys = Object.keys(pair);
1022
+
1023
+ if (keys.length !== 1) return false;
1024
+
1025
+ result[index] = [ keys[0], pair[keys[0]] ];
1026
+ }
1027
+
1028
+ return true;
1029
+ }
1030
+
1031
+ function constructYamlPairs(data) {
1032
+ if (data === null) return [];
1033
+
1034
+ var index, length, pair, keys, result,
1035
+ object = data;
1036
+
1037
+ result = new Array(object.length);
1038
+
1039
+ for (index = 0, length = object.length; index < length; index += 1) {
1040
+ pair = object[index];
1041
+
1042
+ keys = Object.keys(pair);
1043
+
1044
+ result[index] = [ keys[0], pair[keys[0]] ];
1045
+ }
1046
+
1047
+ return result;
1048
+ }
1049
+
1050
+ var pairs = new type('tag:yaml.org,2002:pairs', {
1051
+ kind: 'sequence',
1052
+ resolve: resolveYamlPairs,
1053
+ construct: constructYamlPairs
1054
+ });
1055
+
1056
+ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1057
+
1058
+ function resolveYamlSet(data) {
1059
+ if (data === null) return true;
1060
+
1061
+ var key, object = data;
1062
+
1063
+ for (key in object) {
1064
+ if (_hasOwnProperty$2.call(object, key)) {
1065
+ if (object[key] !== null) return false;
1066
+ }
1067
+ }
1068
+
1069
+ return true;
1070
+ }
1071
+
1072
+ function constructYamlSet(data) {
1073
+ return data !== null ? data : {};
1074
+ }
1075
+
1076
+ var set = new type('tag:yaml.org,2002:set', {
1077
+ kind: 'mapping',
1078
+ resolve: resolveYamlSet,
1079
+ construct: constructYamlSet
1080
+ });
1081
+
1082
+ var _default = core.extend({
1083
+ implicit: [
1084
+ timestamp,
1085
+ merge
1086
+ ],
1087
+ explicit: [
1088
+ binary,
1089
+ omap,
1090
+ pairs,
1091
+ set
1092
+ ]
1093
+ });
1094
+
1095
+ /*eslint-disable max-len,no-use-before-define*/
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+ var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1104
+
1105
+
1106
+ var CONTEXT_FLOW_IN = 1;
1107
+ var CONTEXT_FLOW_OUT = 2;
1108
+ var CONTEXT_BLOCK_IN = 3;
1109
+ var CONTEXT_BLOCK_OUT = 4;
1110
+
1111
+
1112
+ var CHOMPING_CLIP = 1;
1113
+ var CHOMPING_STRIP = 2;
1114
+ var CHOMPING_KEEP = 3;
1115
+
1116
+
1117
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1118
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1119
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1120
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1121
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1122
+
1123
+
1124
+ function _class(obj) { return Object.prototype.toString.call(obj); }
1125
+
1126
+ function is_EOL(c) {
1127
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
1128
+ }
1129
+
1130
+ function is_WHITE_SPACE(c) {
1131
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
1132
+ }
1133
+
1134
+ function is_WS_OR_EOL(c) {
1135
+ return (c === 0x09/* Tab */) ||
1136
+ (c === 0x20/* Space */) ||
1137
+ (c === 0x0A/* LF */) ||
1138
+ (c === 0x0D/* CR */);
1139
+ }
1140
+
1141
+ function is_FLOW_INDICATOR(c) {
1142
+ return c === 0x2C/* , */ ||
1143
+ c === 0x5B/* [ */ ||
1144
+ c === 0x5D/* ] */ ||
1145
+ c === 0x7B/* { */ ||
1146
+ c === 0x7D/* } */;
1147
+ }
1148
+
1149
+ function fromHexCode(c) {
1150
+ var lc;
1151
+
1152
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1153
+ return c - 0x30;
1154
+ }
1155
+
1156
+ /*eslint-disable no-bitwise*/
1157
+ lc = c | 0x20;
1158
+
1159
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
1160
+ return lc - 0x61 + 10;
1161
+ }
1162
+
1163
+ return -1;
1164
+ }
1165
+
1166
+ function escapedHexLen(c) {
1167
+ if (c === 0x78/* x */) { return 2; }
1168
+ if (c === 0x75/* u */) { return 4; }
1169
+ if (c === 0x55/* U */) { return 8; }
1170
+ return 0;
1171
+ }
1172
+
1173
+ function fromDecimalCode(c) {
1174
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1175
+ return c - 0x30;
1176
+ }
1177
+
1178
+ return -1;
1179
+ }
1180
+
1181
+ function simpleEscapeSequence(c) {
1182
+ /* eslint-disable indent */
1183
+ return (c === 0x30/* 0 */) ? '\x00' :
1184
+ (c === 0x61/* a */) ? '\x07' :
1185
+ (c === 0x62/* b */) ? '\x08' :
1186
+ (c === 0x74/* t */) ? '\x09' :
1187
+ (c === 0x09/* Tab */) ? '\x09' :
1188
+ (c === 0x6E/* n */) ? '\x0A' :
1189
+ (c === 0x76/* v */) ? '\x0B' :
1190
+ (c === 0x66/* f */) ? '\x0C' :
1191
+ (c === 0x72/* r */) ? '\x0D' :
1192
+ (c === 0x65/* e */) ? '\x1B' :
1193
+ (c === 0x20/* Space */) ? ' ' :
1194
+ (c === 0x22/* " */) ? '\x22' :
1195
+ (c === 0x2F/* / */) ? '/' :
1196
+ (c === 0x5C/* \ */) ? '\x5C' :
1197
+ (c === 0x4E/* N */) ? '\x85' :
1198
+ (c === 0x5F/* _ */) ? '\xA0' :
1199
+ (c === 0x4C/* L */) ? '\u2028' :
1200
+ (c === 0x50/* P */) ? '\u2029' : '';
1201
+ }
1202
+
1203
+ function charFromCodepoint(c) {
1204
+ if (c <= 0xFFFF) {
1205
+ return String.fromCharCode(c);
1206
+ }
1207
+ // Encode UTF-16 surrogate pair
1208
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
1209
+ return String.fromCharCode(
1210
+ ((c - 0x010000) >> 10) + 0xD800,
1211
+ ((c - 0x010000) & 0x03FF) + 0xDC00
1212
+ );
1213
+ }
1214
+
1215
+ var simpleEscapeCheck = new Array(256); // integer, for fast access
1216
+ var simpleEscapeMap = new Array(256);
1217
+ for (var i = 0; i < 256; i++) {
1218
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1219
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
1220
+ }
1221
+
1222
+
1223
+ function State$1(input, options) {
1224
+ this.input = input;
1225
+
1226
+ this.filename = options['filename'] || null;
1227
+ this.schema = options['schema'] || _default;
1228
+ this.onWarning = options['onWarning'] || null;
1229
+ // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
1230
+ // if such documents have no explicit %YAML directive
1231
+ this.legacy = options['legacy'] || false;
1232
+
1233
+ this.json = options['json'] || false;
1234
+ this.listener = options['listener'] || null;
1235
+
1236
+ this.implicitTypes = this.schema.compiledImplicit;
1237
+ this.typeMap = this.schema.compiledTypeMap;
1238
+
1239
+ this.length = input.length;
1240
+ this.position = 0;
1241
+ this.line = 0;
1242
+ this.lineStart = 0;
1243
+ this.lineIndent = 0;
1244
+
1245
+ // position of first leading tab in the current line,
1246
+ // used to make sure there are no tabs in the indentation
1247
+ this.firstTabInLine = -1;
1248
+
1249
+ this.documents = [];
1250
+
1251
+ /*
1252
+ this.version;
1253
+ this.checkLineBreaks;
1254
+ this.tagMap;
1255
+ this.anchorMap;
1256
+ this.tag;
1257
+ this.anchor;
1258
+ this.kind;
1259
+ this.result;*/
1260
+
1261
+ }
1262
+
1263
+
1264
+ function generateError(state, message) {
1265
+ var mark = {
1266
+ name: state.filename,
1267
+ buffer: state.input.slice(0, -1), // omit trailing \0
1268
+ position: state.position,
1269
+ line: state.line,
1270
+ column: state.position - state.lineStart
1271
+ };
1272
+
1273
+ mark.snippet = snippet(mark);
1274
+
1275
+ return new exception(message, mark);
1276
+ }
1277
+
1278
+ function throwError(state, message) {
1279
+ throw generateError(state, message);
1280
+ }
1281
+
1282
+ function throwWarning(state, message) {
1283
+ if (state.onWarning) {
1284
+ state.onWarning.call(null, generateError(state, message));
1285
+ }
1286
+ }
1287
+
1288
+
1289
+ var directiveHandlers = {
1290
+
1291
+ YAML: function handleYamlDirective(state, name, args) {
1292
+
1293
+ var match, major, minor;
1294
+
1295
+ if (state.version !== null) {
1296
+ throwError(state, 'duplication of %YAML directive');
1297
+ }
1298
+
1299
+ if (args.length !== 1) {
1300
+ throwError(state, 'YAML directive accepts exactly one argument');
1301
+ }
1302
+
1303
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1304
+
1305
+ if (match === null) {
1306
+ throwError(state, 'ill-formed argument of the YAML directive');
1307
+ }
1308
+
1309
+ major = parseInt(match[1], 10);
1310
+ minor = parseInt(match[2], 10);
1311
+
1312
+ if (major !== 1) {
1313
+ throwError(state, 'unacceptable YAML version of the document');
1314
+ }
1315
+
1316
+ state.version = args[0];
1317
+ state.checkLineBreaks = (minor < 2);
1318
+
1319
+ if (minor !== 1 && minor !== 2) {
1320
+ throwWarning(state, 'unsupported YAML version of the document');
1321
+ }
1322
+ },
1323
+
1324
+ TAG: function handleTagDirective(state, name, args) {
1325
+
1326
+ var handle, prefix;
1327
+
1328
+ if (args.length !== 2) {
1329
+ throwError(state, 'TAG directive accepts exactly two arguments');
1330
+ }
1331
+
1332
+ handle = args[0];
1333
+ prefix = args[1];
1334
+
1335
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
1336
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
1337
+ }
1338
+
1339
+ if (_hasOwnProperty$1.call(state.tagMap, handle)) {
1340
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
1341
+ }
1342
+
1343
+ if (!PATTERN_TAG_URI.test(prefix)) {
1344
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
1345
+ }
1346
+
1347
+ try {
1348
+ prefix = decodeURIComponent(prefix);
1349
+ } catch (err) {
1350
+ throwError(state, 'tag prefix is malformed: ' + prefix);
1351
+ }
1352
+
1353
+ state.tagMap[handle] = prefix;
1354
+ }
1355
+ };
1356
+
1357
+
1358
+ function captureSegment(state, start, end, checkJson) {
1359
+ var _position, _length, _character, _result;
1360
+
1361
+ if (start < end) {
1362
+ _result = state.input.slice(start, end);
1363
+
1364
+ if (checkJson) {
1365
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1366
+ _character = _result.charCodeAt(_position);
1367
+ if (!(_character === 0x09 ||
1368
+ (0x20 <= _character && _character <= 0x10FFFF))) {
1369
+ throwError(state, 'expected valid JSON character');
1370
+ }
1371
+ }
1372
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
1373
+ throwError(state, 'the stream contains non-printable characters');
1374
+ }
1375
+
1376
+ state.result += _result;
1377
+ }
1378
+ }
1379
+
1380
+ function mergeMappings(state, destination, source, overridableKeys) {
1381
+ var sourceKeys, key, index, quantity;
1382
+
1383
+ if (!common.isObject(source)) {
1384
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
1385
+ }
1386
+
1387
+ sourceKeys = Object.keys(source);
1388
+
1389
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1390
+ key = sourceKeys[index];
1391
+
1392
+ if (!_hasOwnProperty$1.call(destination, key)) {
1393
+ destination[key] = source[key];
1394
+ overridableKeys[key] = true;
1395
+ }
1396
+ }
1397
+ }
1398
+
1399
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
1400
+ startLine, startLineStart, startPos) {
1401
+
1402
+ var index, quantity;
1403
+
1404
+ // The output is a plain object here, so keys can only be strings.
1405
+ // We need to convert keyNode to a string, but doing so can hang the process
1406
+ // (deeply nested arrays that explode exponentially using aliases).
1407
+ if (Array.isArray(keyNode)) {
1408
+ keyNode = Array.prototype.slice.call(keyNode);
1409
+
1410
+ for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1411
+ if (Array.isArray(keyNode[index])) {
1412
+ throwError(state, 'nested arrays are not supported inside keys');
1413
+ }
1414
+
1415
+ if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
1416
+ keyNode[index] = '[object Object]';
1417
+ }
1418
+ }
1419
+ }
1420
+
1421
+ // Avoid code execution in load() via toString property
1422
+ // (still use its own toString for arrays, timestamps,
1423
+ // and whatever user schema extensions happen to have @@toStringTag)
1424
+ if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
1425
+ keyNode = '[object Object]';
1426
+ }
1427
+
1428
+
1429
+ keyNode = String(keyNode);
1430
+
1431
+ if (_result === null) {
1432
+ _result = {};
1433
+ }
1434
+
1435
+ if (keyTag === 'tag:yaml.org,2002:merge') {
1436
+ if (Array.isArray(valueNode)) {
1437
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1438
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
1439
+ }
1440
+ } else {
1441
+ mergeMappings(state, _result, valueNode, overridableKeys);
1442
+ }
1443
+ } else {
1444
+ if (!state.json &&
1445
+ !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
1446
+ _hasOwnProperty$1.call(_result, keyNode)) {
1447
+ state.line = startLine || state.line;
1448
+ state.lineStart = startLineStart || state.lineStart;
1449
+ state.position = startPos || state.position;
1450
+ throwError(state, 'duplicated mapping key');
1451
+ }
1452
+
1453
+ // used for this specific key only because Object.defineProperty is slow
1454
+ if (keyNode === '__proto__') {
1455
+ Object.defineProperty(_result, keyNode, {
1456
+ configurable: true,
1457
+ enumerable: true,
1458
+ writable: true,
1459
+ value: valueNode
1460
+ });
1461
+ } else {
1462
+ _result[keyNode] = valueNode;
1463
+ }
1464
+ delete overridableKeys[keyNode];
1465
+ }
1466
+
1467
+ return _result;
1468
+ }
1469
+
1470
+ function readLineBreak(state) {
1471
+ var ch;
1472
+
1473
+ ch = state.input.charCodeAt(state.position);
1474
+
1475
+ if (ch === 0x0A/* LF */) {
1476
+ state.position++;
1477
+ } else if (ch === 0x0D/* CR */) {
1478
+ state.position++;
1479
+ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
1480
+ state.position++;
1481
+ }
1482
+ } else {
1483
+ throwError(state, 'a line break is expected');
1484
+ }
1485
+
1486
+ state.line += 1;
1487
+ state.lineStart = state.position;
1488
+ state.firstTabInLine = -1;
1489
+ }
1490
+
1491
+ function skipSeparationSpace(state, allowComments, checkIndent) {
1492
+ var lineBreaks = 0,
1493
+ ch = state.input.charCodeAt(state.position);
1494
+
1495
+ while (ch !== 0) {
1496
+ while (is_WHITE_SPACE(ch)) {
1497
+ if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
1498
+ state.firstTabInLine = state.position;
1499
+ }
1500
+ ch = state.input.charCodeAt(++state.position);
1501
+ }
1502
+
1503
+ if (allowComments && ch === 0x23/* # */) {
1504
+ do {
1505
+ ch = state.input.charCodeAt(++state.position);
1506
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
1507
+ }
1508
+
1509
+ if (is_EOL(ch)) {
1510
+ readLineBreak(state);
1511
+
1512
+ ch = state.input.charCodeAt(state.position);
1513
+ lineBreaks++;
1514
+ state.lineIndent = 0;
1515
+
1516
+ while (ch === 0x20/* Space */) {
1517
+ state.lineIndent++;
1518
+ ch = state.input.charCodeAt(++state.position);
1519
+ }
1520
+ } else {
1521
+ break;
1522
+ }
1523
+ }
1524
+
1525
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
1526
+ throwWarning(state, 'deficient indentation');
1527
+ }
1528
+
1529
+ return lineBreaks;
1530
+ }
1531
+
1532
+ function testDocumentSeparator(state) {
1533
+ var _position = state.position,
1534
+ ch;
1535
+
1536
+ ch = state.input.charCodeAt(_position);
1537
+
1538
+ // Condition state.position === state.lineStart is tested
1539
+ // in parent on each call, for efficiency. No needs to test here again.
1540
+ if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
1541
+ ch === state.input.charCodeAt(_position + 1) &&
1542
+ ch === state.input.charCodeAt(_position + 2)) {
1543
+
1544
+ _position += 3;
1545
+
1546
+ ch = state.input.charCodeAt(_position);
1547
+
1548
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
1549
+ return true;
1550
+ }
1551
+ }
1552
+
1553
+ return false;
1554
+ }
1555
+
1556
+ function writeFoldedLines(state, count) {
1557
+ if (count === 1) {
1558
+ state.result += ' ';
1559
+ } else if (count > 1) {
1560
+ state.result += common.repeat('\n', count - 1);
1561
+ }
1562
+ }
1563
+
1564
+
1565
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1566
+ var preceding,
1567
+ following,
1568
+ captureStart,
1569
+ captureEnd,
1570
+ hasPendingContent,
1571
+ _line,
1572
+ _lineStart,
1573
+ _lineIndent,
1574
+ _kind = state.kind,
1575
+ _result = state.result,
1576
+ ch;
1577
+
1578
+ ch = state.input.charCodeAt(state.position);
1579
+
1580
+ if (is_WS_OR_EOL(ch) ||
1581
+ is_FLOW_INDICATOR(ch) ||
1582
+ ch === 0x23/* # */ ||
1583
+ ch === 0x26/* & */ ||
1584
+ ch === 0x2A/* * */ ||
1585
+ ch === 0x21/* ! */ ||
1586
+ ch === 0x7C/* | */ ||
1587
+ ch === 0x3E/* > */ ||
1588
+ ch === 0x27/* ' */ ||
1589
+ ch === 0x22/* " */ ||
1590
+ ch === 0x25/* % */ ||
1591
+ ch === 0x40/* @ */ ||
1592
+ ch === 0x60/* ` */) {
1593
+ return false;
1594
+ }
1595
+
1596
+ if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
1597
+ following = state.input.charCodeAt(state.position + 1);
1598
+
1599
+ if (is_WS_OR_EOL(following) ||
1600
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
1601
+ return false;
1602
+ }
1603
+ }
1604
+
1605
+ state.kind = 'scalar';
1606
+ state.result = '';
1607
+ captureStart = captureEnd = state.position;
1608
+ hasPendingContent = false;
1609
+
1610
+ while (ch !== 0) {
1611
+ if (ch === 0x3A/* : */) {
1612
+ following = state.input.charCodeAt(state.position + 1);
1613
+
1614
+ if (is_WS_OR_EOL(following) ||
1615
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
1616
+ break;
1617
+ }
1618
+
1619
+ } else if (ch === 0x23/* # */) {
1620
+ preceding = state.input.charCodeAt(state.position - 1);
1621
+
1622
+ if (is_WS_OR_EOL(preceding)) {
1623
+ break;
1624
+ }
1625
+
1626
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
1627
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1628
+ break;
1629
+
1630
+ } else if (is_EOL(ch)) {
1631
+ _line = state.line;
1632
+ _lineStart = state.lineStart;
1633
+ _lineIndent = state.lineIndent;
1634
+ skipSeparationSpace(state, false, -1);
1635
+
1636
+ if (state.lineIndent >= nodeIndent) {
1637
+ hasPendingContent = true;
1638
+ ch = state.input.charCodeAt(state.position);
1639
+ continue;
1640
+ } else {
1641
+ state.position = captureEnd;
1642
+ state.line = _line;
1643
+ state.lineStart = _lineStart;
1644
+ state.lineIndent = _lineIndent;
1645
+ break;
1646
+ }
1647
+ }
1648
+
1649
+ if (hasPendingContent) {
1650
+ captureSegment(state, captureStart, captureEnd, false);
1651
+ writeFoldedLines(state, state.line - _line);
1652
+ captureStart = captureEnd = state.position;
1653
+ hasPendingContent = false;
1654
+ }
1655
+
1656
+ if (!is_WHITE_SPACE(ch)) {
1657
+ captureEnd = state.position + 1;
1658
+ }
1659
+
1660
+ ch = state.input.charCodeAt(++state.position);
1661
+ }
1662
+
1663
+ captureSegment(state, captureStart, captureEnd, false);
1664
+
1665
+ if (state.result) {
1666
+ return true;
1667
+ }
1668
+
1669
+ state.kind = _kind;
1670
+ state.result = _result;
1671
+ return false;
1672
+ }
1673
+
1674
+ function readSingleQuotedScalar(state, nodeIndent) {
1675
+ var ch,
1676
+ captureStart, captureEnd;
1677
+
1678
+ ch = state.input.charCodeAt(state.position);
1679
+
1680
+ if (ch !== 0x27/* ' */) {
1681
+ return false;
1682
+ }
1683
+
1684
+ state.kind = 'scalar';
1685
+ state.result = '';
1686
+ state.position++;
1687
+ captureStart = captureEnd = state.position;
1688
+
1689
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1690
+ if (ch === 0x27/* ' */) {
1691
+ captureSegment(state, captureStart, state.position, true);
1692
+ ch = state.input.charCodeAt(++state.position);
1693
+
1694
+ if (ch === 0x27/* ' */) {
1695
+ captureStart = state.position;
1696
+ state.position++;
1697
+ captureEnd = state.position;
1698
+ } else {
1699
+ return true;
1700
+ }
1701
+
1702
+ } else if (is_EOL(ch)) {
1703
+ captureSegment(state, captureStart, captureEnd, true);
1704
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1705
+ captureStart = captureEnd = state.position;
1706
+
1707
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1708
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
1709
+
1710
+ } else {
1711
+ state.position++;
1712
+ captureEnd = state.position;
1713
+ }
1714
+ }
1715
+
1716
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
1717
+ }
1718
+
1719
+ function readDoubleQuotedScalar(state, nodeIndent) {
1720
+ var captureStart,
1721
+ captureEnd,
1722
+ hexLength,
1723
+ hexResult,
1724
+ tmp,
1725
+ ch;
1726
+
1727
+ ch = state.input.charCodeAt(state.position);
1728
+
1729
+ if (ch !== 0x22/* " */) {
1730
+ return false;
1731
+ }
1732
+
1733
+ state.kind = 'scalar';
1734
+ state.result = '';
1735
+ state.position++;
1736
+ captureStart = captureEnd = state.position;
1737
+
1738
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1739
+ if (ch === 0x22/* " */) {
1740
+ captureSegment(state, captureStart, state.position, true);
1741
+ state.position++;
1742
+ return true;
1743
+
1744
+ } else if (ch === 0x5C/* \ */) {
1745
+ captureSegment(state, captureStart, state.position, true);
1746
+ ch = state.input.charCodeAt(++state.position);
1747
+
1748
+ if (is_EOL(ch)) {
1749
+ skipSeparationSpace(state, false, nodeIndent);
1750
+
1751
+ // TODO: rework to inline fn with no type cast?
1752
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
1753
+ state.result += simpleEscapeMap[ch];
1754
+ state.position++;
1755
+
1756
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
1757
+ hexLength = tmp;
1758
+ hexResult = 0;
1759
+
1760
+ for (; hexLength > 0; hexLength--) {
1761
+ ch = state.input.charCodeAt(++state.position);
1762
+
1763
+ if ((tmp = fromHexCode(ch)) >= 0) {
1764
+ hexResult = (hexResult << 4) + tmp;
1765
+
1766
+ } else {
1767
+ throwError(state, 'expected hexadecimal character');
1768
+ }
1769
+ }
1770
+
1771
+ state.result += charFromCodepoint(hexResult);
1772
+
1773
+ state.position++;
1774
+
1775
+ } else {
1776
+ throwError(state, 'unknown escape sequence');
1777
+ }
1778
+
1779
+ captureStart = captureEnd = state.position;
1780
+
1781
+ } else if (is_EOL(ch)) {
1782
+ captureSegment(state, captureStart, captureEnd, true);
1783
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1784
+ captureStart = captureEnd = state.position;
1785
+
1786
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1787
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
1788
+
1789
+ } else {
1790
+ state.position++;
1791
+ captureEnd = state.position;
1792
+ }
1793
+ }
1794
+
1795
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
1796
+ }
1797
+
1798
+ function readFlowCollection(state, nodeIndent) {
1799
+ var readNext = true,
1800
+ _line,
1801
+ _lineStart,
1802
+ _pos,
1803
+ _tag = state.tag,
1804
+ _result,
1805
+ _anchor = state.anchor,
1806
+ following,
1807
+ terminator,
1808
+ isPair,
1809
+ isExplicitPair,
1810
+ isMapping,
1811
+ overridableKeys = Object.create(null),
1812
+ keyNode,
1813
+ keyTag,
1814
+ valueNode,
1815
+ ch;
1816
+
1817
+ ch = state.input.charCodeAt(state.position);
1818
+
1819
+ if (ch === 0x5B/* [ */) {
1820
+ terminator = 0x5D;/* ] */
1821
+ isMapping = false;
1822
+ _result = [];
1823
+ } else if (ch === 0x7B/* { */) {
1824
+ terminator = 0x7D;/* } */
1825
+ isMapping = true;
1826
+ _result = {};
1827
+ } else {
1828
+ return false;
1829
+ }
1830
+
1831
+ if (state.anchor !== null) {
1832
+ state.anchorMap[state.anchor] = _result;
1833
+ }
1834
+
1835
+ ch = state.input.charCodeAt(++state.position);
1836
+
1837
+ while (ch !== 0) {
1838
+ skipSeparationSpace(state, true, nodeIndent);
1839
+
1840
+ ch = state.input.charCodeAt(state.position);
1841
+
1842
+ if (ch === terminator) {
1843
+ state.position++;
1844
+ state.tag = _tag;
1845
+ state.anchor = _anchor;
1846
+ state.kind = isMapping ? 'mapping' : 'sequence';
1847
+ state.result = _result;
1848
+ return true;
1849
+ } else if (!readNext) {
1850
+ throwError(state, 'missed comma between flow collection entries');
1851
+ } else if (ch === 0x2C/* , */) {
1852
+ // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
1853
+ throwError(state, "expected the node content, but found ','");
1854
+ }
1855
+
1856
+ keyTag = keyNode = valueNode = null;
1857
+ isPair = isExplicitPair = false;
1858
+
1859
+ if (ch === 0x3F/* ? */) {
1860
+ following = state.input.charCodeAt(state.position + 1);
1861
+
1862
+ if (is_WS_OR_EOL(following)) {
1863
+ isPair = isExplicitPair = true;
1864
+ state.position++;
1865
+ skipSeparationSpace(state, true, nodeIndent);
1866
+ }
1867
+ }
1868
+
1869
+ _line = state.line; // Save the current line.
1870
+ _lineStart = state.lineStart;
1871
+ _pos = state.position;
1872
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1873
+ keyTag = state.tag;
1874
+ keyNode = state.result;
1875
+ skipSeparationSpace(state, true, nodeIndent);
1876
+
1877
+ ch = state.input.charCodeAt(state.position);
1878
+
1879
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
1880
+ isPair = true;
1881
+ ch = state.input.charCodeAt(++state.position);
1882
+ skipSeparationSpace(state, true, nodeIndent);
1883
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1884
+ valueNode = state.result;
1885
+ }
1886
+
1887
+ if (isMapping) {
1888
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
1889
+ } else if (isPair) {
1890
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
1891
+ } else {
1892
+ _result.push(keyNode);
1893
+ }
1894
+
1895
+ skipSeparationSpace(state, true, nodeIndent);
1896
+
1897
+ ch = state.input.charCodeAt(state.position);
1898
+
1899
+ if (ch === 0x2C/* , */) {
1900
+ readNext = true;
1901
+ ch = state.input.charCodeAt(++state.position);
1902
+ } else {
1903
+ readNext = false;
1904
+ }
1905
+ }
1906
+
1907
+ throwError(state, 'unexpected end of the stream within a flow collection');
1908
+ }
1909
+
1910
+ function readBlockScalar(state, nodeIndent) {
1911
+ var captureStart,
1912
+ folding,
1913
+ chomping = CHOMPING_CLIP,
1914
+ didReadContent = false,
1915
+ detectedIndent = false,
1916
+ textIndent = nodeIndent,
1917
+ emptyLines = 0,
1918
+ atMoreIndented = false,
1919
+ tmp,
1920
+ ch;
1921
+
1922
+ ch = state.input.charCodeAt(state.position);
1923
+
1924
+ if (ch === 0x7C/* | */) {
1925
+ folding = false;
1926
+ } else if (ch === 0x3E/* > */) {
1927
+ folding = true;
1928
+ } else {
1929
+ return false;
1930
+ }
1931
+
1932
+ state.kind = 'scalar';
1933
+ state.result = '';
1934
+
1935
+ while (ch !== 0) {
1936
+ ch = state.input.charCodeAt(++state.position);
1937
+
1938
+ if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
1939
+ if (CHOMPING_CLIP === chomping) {
1940
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
1941
+ } else {
1942
+ throwError(state, 'repeat of a chomping mode identifier');
1943
+ }
1944
+
1945
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1946
+ if (tmp === 0) {
1947
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
1948
+ } else if (!detectedIndent) {
1949
+ textIndent = nodeIndent + tmp - 1;
1950
+ detectedIndent = true;
1951
+ } else {
1952
+ throwError(state, 'repeat of an indentation width identifier');
1953
+ }
1954
+
1955
+ } else {
1956
+ break;
1957
+ }
1958
+ }
1959
+
1960
+ if (is_WHITE_SPACE(ch)) {
1961
+ do { ch = state.input.charCodeAt(++state.position); }
1962
+ while (is_WHITE_SPACE(ch));
1963
+
1964
+ if (ch === 0x23/* # */) {
1965
+ do { ch = state.input.charCodeAt(++state.position); }
1966
+ while (!is_EOL(ch) && (ch !== 0));
1967
+ }
1968
+ }
1969
+
1970
+ while (ch !== 0) {
1971
+ readLineBreak(state);
1972
+ state.lineIndent = 0;
1973
+
1974
+ ch = state.input.charCodeAt(state.position);
1975
+
1976
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
1977
+ (ch === 0x20/* Space */)) {
1978
+ state.lineIndent++;
1979
+ ch = state.input.charCodeAt(++state.position);
1980
+ }
1981
+
1982
+ if (!detectedIndent && state.lineIndent > textIndent) {
1983
+ textIndent = state.lineIndent;
1984
+ }
1985
+
1986
+ if (is_EOL(ch)) {
1987
+ emptyLines++;
1988
+ continue;
1989
+ }
1990
+
1991
+ // End of the scalar.
1992
+ if (state.lineIndent < textIndent) {
1993
+
1994
+ // Perform the chomping.
1995
+ if (chomping === CHOMPING_KEEP) {
1996
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1997
+ } else if (chomping === CHOMPING_CLIP) {
1998
+ if (didReadContent) { // i.e. only if the scalar is not empty.
1999
+ state.result += '\n';
2000
+ }
2001
+ }
2002
+
2003
+ // Break this `while` cycle and go to the funciton's epilogue.
2004
+ break;
2005
+ }
2006
+
2007
+ // Folded style: use fancy rules to handle line breaks.
2008
+ if (folding) {
2009
+
2010
+ // Lines starting with white space characters (more-indented lines) are not folded.
2011
+ if (is_WHITE_SPACE(ch)) {
2012
+ atMoreIndented = true;
2013
+ // except for the first content line (cf. Example 8.1)
2014
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
2015
+
2016
+ // End of more-indented block.
2017
+ } else if (atMoreIndented) {
2018
+ atMoreIndented = false;
2019
+ state.result += common.repeat('\n', emptyLines + 1);
2020
+
2021
+ // Just one line break - perceive as the same line.
2022
+ } else if (emptyLines === 0) {
2023
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
2024
+ state.result += ' ';
2025
+ }
2026
+
2027
+ // Several line breaks - perceive as different lines.
2028
+ } else {
2029
+ state.result += common.repeat('\n', emptyLines);
2030
+ }
2031
+
2032
+ // Literal style: just add exact number of line breaks between content lines.
2033
+ } else {
2034
+ // Keep all line breaks except the header line break.
2035
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
2036
+ }
2037
+
2038
+ didReadContent = true;
2039
+ detectedIndent = true;
2040
+ emptyLines = 0;
2041
+ captureStart = state.position;
2042
+
2043
+ while (!is_EOL(ch) && (ch !== 0)) {
2044
+ ch = state.input.charCodeAt(++state.position);
2045
+ }
2046
+
2047
+ captureSegment(state, captureStart, state.position, false);
2048
+ }
2049
+
2050
+ return true;
2051
+ }
2052
+
2053
+ function readBlockSequence(state, nodeIndent) {
2054
+ var _line,
2055
+ _tag = state.tag,
2056
+ _anchor = state.anchor,
2057
+ _result = [],
2058
+ following,
2059
+ detected = false,
2060
+ ch;
2061
+
2062
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
2063
+ // it can still be flow sequence/mapping or a scalar
2064
+ if (state.firstTabInLine !== -1) return false;
2065
+
2066
+ if (state.anchor !== null) {
2067
+ state.anchorMap[state.anchor] = _result;
2068
+ }
2069
+
2070
+ ch = state.input.charCodeAt(state.position);
2071
+
2072
+ while (ch !== 0) {
2073
+ if (state.firstTabInLine !== -1) {
2074
+ state.position = state.firstTabInLine;
2075
+ throwError(state, 'tab characters must not be used in indentation');
2076
+ }
2077
+
2078
+ if (ch !== 0x2D/* - */) {
2079
+ break;
2080
+ }
2081
+
2082
+ following = state.input.charCodeAt(state.position + 1);
2083
+
2084
+ if (!is_WS_OR_EOL(following)) {
2085
+ break;
2086
+ }
2087
+
2088
+ detected = true;
2089
+ state.position++;
2090
+
2091
+ if (skipSeparationSpace(state, true, -1)) {
2092
+ if (state.lineIndent <= nodeIndent) {
2093
+ _result.push(null);
2094
+ ch = state.input.charCodeAt(state.position);
2095
+ continue;
2096
+ }
2097
+ }
2098
+
2099
+ _line = state.line;
2100
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
2101
+ _result.push(state.result);
2102
+ skipSeparationSpace(state, true, -1);
2103
+
2104
+ ch = state.input.charCodeAt(state.position);
2105
+
2106
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
2107
+ throwError(state, 'bad indentation of a sequence entry');
2108
+ } else if (state.lineIndent < nodeIndent) {
2109
+ break;
2110
+ }
2111
+ }
2112
+
2113
+ if (detected) {
2114
+ state.tag = _tag;
2115
+ state.anchor = _anchor;
2116
+ state.kind = 'sequence';
2117
+ state.result = _result;
2118
+ return true;
2119
+ }
2120
+ return false;
2121
+ }
2122
+
2123
+ function readBlockMapping(state, nodeIndent, flowIndent) {
2124
+ var following,
2125
+ allowCompact,
2126
+ _line,
2127
+ _keyLine,
2128
+ _keyLineStart,
2129
+ _keyPos,
2130
+ _tag = state.tag,
2131
+ _anchor = state.anchor,
2132
+ _result = {},
2133
+ overridableKeys = Object.create(null),
2134
+ keyTag = null,
2135
+ keyNode = null,
2136
+ valueNode = null,
2137
+ atExplicitKey = false,
2138
+ detected = false,
2139
+ ch;
2140
+
2141
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
2142
+ // it can still be flow sequence/mapping or a scalar
2143
+ if (state.firstTabInLine !== -1) return false;
2144
+
2145
+ if (state.anchor !== null) {
2146
+ state.anchorMap[state.anchor] = _result;
2147
+ }
2148
+
2149
+ ch = state.input.charCodeAt(state.position);
2150
+
2151
+ while (ch !== 0) {
2152
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
2153
+ state.position = state.firstTabInLine;
2154
+ throwError(state, 'tab characters must not be used in indentation');
2155
+ }
2156
+
2157
+ following = state.input.charCodeAt(state.position + 1);
2158
+ _line = state.line; // Save the current line.
2159
+
2160
+ //
2161
+ // Explicit notation case. There are two separate blocks:
2162
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
2163
+ //
2164
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
2165
+
2166
+ if (ch === 0x3F/* ? */) {
2167
+ if (atExplicitKey) {
2168
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2169
+ keyTag = keyNode = valueNode = null;
2170
+ }
2171
+
2172
+ detected = true;
2173
+ atExplicitKey = true;
2174
+ allowCompact = true;
2175
+
2176
+ } else if (atExplicitKey) {
2177
+ // i.e. 0x3A/* : */ === character after the explicit key.
2178
+ atExplicitKey = false;
2179
+ allowCompact = true;
2180
+
2181
+ } else {
2182
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
2183
+ }
2184
+
2185
+ state.position += 1;
2186
+ ch = following;
2187
+
2188
+ //
2189
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
2190
+ //
2191
+ } else {
2192
+ _keyLine = state.line;
2193
+ _keyLineStart = state.lineStart;
2194
+ _keyPos = state.position;
2195
+
2196
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
2197
+ // Neither implicit nor explicit notation.
2198
+ // Reading is done. Go to the epilogue.
2199
+ break;
2200
+ }
2201
+
2202
+ if (state.line === _line) {
2203
+ ch = state.input.charCodeAt(state.position);
2204
+
2205
+ while (is_WHITE_SPACE(ch)) {
2206
+ ch = state.input.charCodeAt(++state.position);
2207
+ }
2208
+
2209
+ if (ch === 0x3A/* : */) {
2210
+ ch = state.input.charCodeAt(++state.position);
2211
+
2212
+ if (!is_WS_OR_EOL(ch)) {
2213
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
2214
+ }
2215
+
2216
+ if (atExplicitKey) {
2217
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2218
+ keyTag = keyNode = valueNode = null;
2219
+ }
2220
+
2221
+ detected = true;
2222
+ atExplicitKey = false;
2223
+ allowCompact = false;
2224
+ keyTag = state.tag;
2225
+ keyNode = state.result;
2226
+
2227
+ } else if (detected) {
2228
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
2229
+
2230
+ } else {
2231
+ state.tag = _tag;
2232
+ state.anchor = _anchor;
2233
+ return true; // Keep the result of `composeNode`.
2234
+ }
2235
+
2236
+ } else if (detected) {
2237
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
2238
+
2239
+ } else {
2240
+ state.tag = _tag;
2241
+ state.anchor = _anchor;
2242
+ return true; // Keep the result of `composeNode`.
2243
+ }
2244
+ }
2245
+
2246
+ //
2247
+ // Common reading code for both explicit and implicit notations.
2248
+ //
2249
+ if (state.line === _line || state.lineIndent > nodeIndent) {
2250
+ if (atExplicitKey) {
2251
+ _keyLine = state.line;
2252
+ _keyLineStart = state.lineStart;
2253
+ _keyPos = state.position;
2254
+ }
2255
+
2256
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
2257
+ if (atExplicitKey) {
2258
+ keyNode = state.result;
2259
+ } else {
2260
+ valueNode = state.result;
2261
+ }
2262
+ }
2263
+
2264
+ if (!atExplicitKey) {
2265
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
2266
+ keyTag = keyNode = valueNode = null;
2267
+ }
2268
+
2269
+ skipSeparationSpace(state, true, -1);
2270
+ ch = state.input.charCodeAt(state.position);
2271
+ }
2272
+
2273
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
2274
+ throwError(state, 'bad indentation of a mapping entry');
2275
+ } else if (state.lineIndent < nodeIndent) {
2276
+ break;
2277
+ }
2278
+ }
2279
+
2280
+ //
2281
+ // Epilogue.
2282
+ //
2283
+
2284
+ // Special case: last mapping's node contains only the key in explicit notation.
2285
+ if (atExplicitKey) {
2286
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2287
+ }
2288
+
2289
+ // Expose the resulting mapping.
2290
+ if (detected) {
2291
+ state.tag = _tag;
2292
+ state.anchor = _anchor;
2293
+ state.kind = 'mapping';
2294
+ state.result = _result;
2295
+ }
2296
+
2297
+ return detected;
2298
+ }
2299
+
2300
+ function readTagProperty(state) {
2301
+ var _position,
2302
+ isVerbatim = false,
2303
+ isNamed = false,
2304
+ tagHandle,
2305
+ tagName,
2306
+ ch;
2307
+
2308
+ ch = state.input.charCodeAt(state.position);
2309
+
2310
+ if (ch !== 0x21/* ! */) return false;
2311
+
2312
+ if (state.tag !== null) {
2313
+ throwError(state, 'duplication of a tag property');
2314
+ }
2315
+
2316
+ ch = state.input.charCodeAt(++state.position);
2317
+
2318
+ if (ch === 0x3C/* < */) {
2319
+ isVerbatim = true;
2320
+ ch = state.input.charCodeAt(++state.position);
2321
+
2322
+ } else if (ch === 0x21/* ! */) {
2323
+ isNamed = true;
2324
+ tagHandle = '!!';
2325
+ ch = state.input.charCodeAt(++state.position);
2326
+
2327
+ } else {
2328
+ tagHandle = '!';
2329
+ }
2330
+
2331
+ _position = state.position;
2332
+
2333
+ if (isVerbatim) {
2334
+ do { ch = state.input.charCodeAt(++state.position); }
2335
+ while (ch !== 0 && ch !== 0x3E/* > */);
2336
+
2337
+ if (state.position < state.length) {
2338
+ tagName = state.input.slice(_position, state.position);
2339
+ ch = state.input.charCodeAt(++state.position);
2340
+ } else {
2341
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
2342
+ }
2343
+ } else {
2344
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2345
+
2346
+ if (ch === 0x21/* ! */) {
2347
+ if (!isNamed) {
2348
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
2349
+
2350
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
2351
+ throwError(state, 'named tag handle cannot contain such characters');
2352
+ }
2353
+
2354
+ isNamed = true;
2355
+ _position = state.position + 1;
2356
+ } else {
2357
+ throwError(state, 'tag suffix cannot contain exclamation marks');
2358
+ }
2359
+ }
2360
+
2361
+ ch = state.input.charCodeAt(++state.position);
2362
+ }
2363
+
2364
+ tagName = state.input.slice(_position, state.position);
2365
+
2366
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
2367
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
2368
+ }
2369
+ }
2370
+
2371
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
2372
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
2373
+ }
2374
+
2375
+ try {
2376
+ tagName = decodeURIComponent(tagName);
2377
+ } catch (err) {
2378
+ throwError(state, 'tag name is malformed: ' + tagName);
2379
+ }
2380
+
2381
+ if (isVerbatim) {
2382
+ state.tag = tagName;
2383
+
2384
+ } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
2385
+ state.tag = state.tagMap[tagHandle] + tagName;
2386
+
2387
+ } else if (tagHandle === '!') {
2388
+ state.tag = '!' + tagName;
2389
+
2390
+ } else if (tagHandle === '!!') {
2391
+ state.tag = 'tag:yaml.org,2002:' + tagName;
2392
+
2393
+ } else {
2394
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
2395
+ }
2396
+
2397
+ return true;
2398
+ }
2399
+
2400
+ function readAnchorProperty(state) {
2401
+ var _position,
2402
+ ch;
2403
+
2404
+ ch = state.input.charCodeAt(state.position);
2405
+
2406
+ if (ch !== 0x26/* & */) return false;
2407
+
2408
+ if (state.anchor !== null) {
2409
+ throwError(state, 'duplication of an anchor property');
2410
+ }
2411
+
2412
+ ch = state.input.charCodeAt(++state.position);
2413
+ _position = state.position;
2414
+
2415
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
2416
+ ch = state.input.charCodeAt(++state.position);
2417
+ }
2418
+
2419
+ if (state.position === _position) {
2420
+ throwError(state, 'name of an anchor node must contain at least one character');
2421
+ }
2422
+
2423
+ state.anchor = state.input.slice(_position, state.position);
2424
+ return true;
2425
+ }
2426
+
2427
+ function readAlias(state) {
2428
+ var _position, alias,
2429
+ ch;
2430
+
2431
+ ch = state.input.charCodeAt(state.position);
2432
+
2433
+ if (ch !== 0x2A/* * */) return false;
2434
+
2435
+ ch = state.input.charCodeAt(++state.position);
2436
+ _position = state.position;
2437
+
2438
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
2439
+ ch = state.input.charCodeAt(++state.position);
2440
+ }
2441
+
2442
+ if (state.position === _position) {
2443
+ throwError(state, 'name of an alias node must contain at least one character');
2444
+ }
2445
+
2446
+ alias = state.input.slice(_position, state.position);
2447
+
2448
+ if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
2449
+ throwError(state, 'unidentified alias "' + alias + '"');
2450
+ }
2451
+
2452
+ state.result = state.anchorMap[alias];
2453
+ skipSeparationSpace(state, true, -1);
2454
+ return true;
2455
+ }
2456
+
2457
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
2458
+ var allowBlockStyles,
2459
+ allowBlockScalars,
2460
+ allowBlockCollections,
2461
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
2462
+ atNewLine = false,
2463
+ hasContent = false,
2464
+ typeIndex,
2465
+ typeQuantity,
2466
+ typeList,
2467
+ type,
2468
+ flowIndent,
2469
+ blockIndent;
2470
+
2471
+ if (state.listener !== null) {
2472
+ state.listener('open', state);
2473
+ }
2474
+
2475
+ state.tag = null;
2476
+ state.anchor = null;
2477
+ state.kind = null;
2478
+ state.result = null;
2479
+
2480
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
2481
+ CONTEXT_BLOCK_OUT === nodeContext ||
2482
+ CONTEXT_BLOCK_IN === nodeContext;
2483
+
2484
+ if (allowToSeek) {
2485
+ if (skipSeparationSpace(state, true, -1)) {
2486
+ atNewLine = true;
2487
+
2488
+ if (state.lineIndent > parentIndent) {
2489
+ indentStatus = 1;
2490
+ } else if (state.lineIndent === parentIndent) {
2491
+ indentStatus = 0;
2492
+ } else if (state.lineIndent < parentIndent) {
2493
+ indentStatus = -1;
2494
+ }
2495
+ }
2496
+ }
2497
+
2498
+ if (indentStatus === 1) {
2499
+ while (readTagProperty(state) || readAnchorProperty(state)) {
2500
+ if (skipSeparationSpace(state, true, -1)) {
2501
+ atNewLine = true;
2502
+ allowBlockCollections = allowBlockStyles;
2503
+
2504
+ if (state.lineIndent > parentIndent) {
2505
+ indentStatus = 1;
2506
+ } else if (state.lineIndent === parentIndent) {
2507
+ indentStatus = 0;
2508
+ } else if (state.lineIndent < parentIndent) {
2509
+ indentStatus = -1;
2510
+ }
2511
+ } else {
2512
+ allowBlockCollections = false;
2513
+ }
2514
+ }
2515
+ }
2516
+
2517
+ if (allowBlockCollections) {
2518
+ allowBlockCollections = atNewLine || allowCompact;
2519
+ }
2520
+
2521
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
2522
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
2523
+ flowIndent = parentIndent;
2524
+ } else {
2525
+ flowIndent = parentIndent + 1;
2526
+ }
2527
+
2528
+ blockIndent = state.position - state.lineStart;
2529
+
2530
+ if (indentStatus === 1) {
2531
+ if (allowBlockCollections &&
2532
+ (readBlockSequence(state, blockIndent) ||
2533
+ readBlockMapping(state, blockIndent, flowIndent)) ||
2534
+ readFlowCollection(state, flowIndent)) {
2535
+ hasContent = true;
2536
+ } else {
2537
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
2538
+ readSingleQuotedScalar(state, flowIndent) ||
2539
+ readDoubleQuotedScalar(state, flowIndent)) {
2540
+ hasContent = true;
2541
+
2542
+ } else if (readAlias(state)) {
2543
+ hasContent = true;
2544
+
2545
+ if (state.tag !== null || state.anchor !== null) {
2546
+ throwError(state, 'alias node should not have any properties');
2547
+ }
2548
+
2549
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2550
+ hasContent = true;
2551
+
2552
+ if (state.tag === null) {
2553
+ state.tag = '?';
2554
+ }
2555
+ }
2556
+
2557
+ if (state.anchor !== null) {
2558
+ state.anchorMap[state.anchor] = state.result;
2559
+ }
2560
+ }
2561
+ } else if (indentStatus === 0) {
2562
+ // Special case: block sequences are allowed to have same indentation level as the parent.
2563
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
2564
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2565
+ }
2566
+ }
2567
+
2568
+ if (state.tag === null) {
2569
+ if (state.anchor !== null) {
2570
+ state.anchorMap[state.anchor] = state.result;
2571
+ }
2572
+
2573
+ } else if (state.tag === '?') {
2574
+ // Implicit resolving is not allowed for non-scalar types, and '?'
2575
+ // non-specific tag is only automatically assigned to plain scalars.
2576
+ //
2577
+ // We only need to check kind conformity in case user explicitly assigns '?'
2578
+ // tag, for example like this: "!<?> [0]"
2579
+ //
2580
+ if (state.result !== null && state.kind !== 'scalar') {
2581
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
2582
+ }
2583
+
2584
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
2585
+ type = state.implicitTypes[typeIndex];
2586
+
2587
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
2588
+ state.result = type.construct(state.result);
2589
+ state.tag = type.tag;
2590
+ if (state.anchor !== null) {
2591
+ state.anchorMap[state.anchor] = state.result;
2592
+ }
2593
+ break;
2594
+ }
2595
+ }
2596
+ } else if (state.tag !== '!') {
2597
+ if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
2598
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
2599
+ } else {
2600
+ // looking for multi type
2601
+ type = null;
2602
+ typeList = state.typeMap.multi[state.kind || 'fallback'];
2603
+
2604
+ for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
2605
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
2606
+ type = typeList[typeIndex];
2607
+ break;
2608
+ }
2609
+ }
2610
+ }
2611
+
2612
+ if (!type) {
2613
+ throwError(state, 'unknown tag !<' + state.tag + '>');
2614
+ }
2615
+
2616
+ if (state.result !== null && type.kind !== state.kind) {
2617
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
2618
+ }
2619
+
2620
+ if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
2621
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
2622
+ } else {
2623
+ state.result = type.construct(state.result, state.tag);
2624
+ if (state.anchor !== null) {
2625
+ state.anchorMap[state.anchor] = state.result;
2626
+ }
2627
+ }
2628
+ }
2629
+
2630
+ if (state.listener !== null) {
2631
+ state.listener('close', state);
2632
+ }
2633
+ return state.tag !== null || state.anchor !== null || hasContent;
2634
+ }
2635
+
2636
+ function readDocument(state) {
2637
+ var documentStart = state.position,
2638
+ _position,
2639
+ directiveName,
2640
+ directiveArgs,
2641
+ hasDirectives = false,
2642
+ ch;
2643
+
2644
+ state.version = null;
2645
+ state.checkLineBreaks = state.legacy;
2646
+ state.tagMap = Object.create(null);
2647
+ state.anchorMap = Object.create(null);
2648
+
2649
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2650
+ skipSeparationSpace(state, true, -1);
2651
+
2652
+ ch = state.input.charCodeAt(state.position);
2653
+
2654
+ if (state.lineIndent > 0 || ch !== 0x25/* % */) {
2655
+ break;
2656
+ }
2657
+
2658
+ hasDirectives = true;
2659
+ ch = state.input.charCodeAt(++state.position);
2660
+ _position = state.position;
2661
+
2662
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2663
+ ch = state.input.charCodeAt(++state.position);
2664
+ }
2665
+
2666
+ directiveName = state.input.slice(_position, state.position);
2667
+ directiveArgs = [];
2668
+
2669
+ if (directiveName.length < 1) {
2670
+ throwError(state, 'directive name must not be less than one character in length');
2671
+ }
2672
+
2673
+ while (ch !== 0) {
2674
+ while (is_WHITE_SPACE(ch)) {
2675
+ ch = state.input.charCodeAt(++state.position);
2676
+ }
2677
+
2678
+ if (ch === 0x23/* # */) {
2679
+ do { ch = state.input.charCodeAt(++state.position); }
2680
+ while (ch !== 0 && !is_EOL(ch));
2681
+ break;
2682
+ }
2683
+
2684
+ if (is_EOL(ch)) break;
2685
+
2686
+ _position = state.position;
2687
+
2688
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2689
+ ch = state.input.charCodeAt(++state.position);
2690
+ }
2691
+
2692
+ directiveArgs.push(state.input.slice(_position, state.position));
2693
+ }
2694
+
2695
+ if (ch !== 0) readLineBreak(state);
2696
+
2697
+ if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
2698
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
2699
+ } else {
2700
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
2701
+ }
2702
+ }
2703
+
2704
+ skipSeparationSpace(state, true, -1);
2705
+
2706
+ if (state.lineIndent === 0 &&
2707
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
2708
+ state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
2709
+ state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
2710
+ state.position += 3;
2711
+ skipSeparationSpace(state, true, -1);
2712
+
2713
+ } else if (hasDirectives) {
2714
+ throwError(state, 'directives end mark is expected');
2715
+ }
2716
+
2717
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2718
+ skipSeparationSpace(state, true, -1);
2719
+
2720
+ if (state.checkLineBreaks &&
2721
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
2722
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
2723
+ }
2724
+
2725
+ state.documents.push(state.result);
2726
+
2727
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2728
+
2729
+ if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
2730
+ state.position += 3;
2731
+ skipSeparationSpace(state, true, -1);
2732
+ }
2733
+ return;
2734
+ }
2735
+
2736
+ if (state.position < (state.length - 1)) {
2737
+ throwError(state, 'end of the stream or a document separator is expected');
2738
+ } else {
2739
+ return;
2740
+ }
2741
+ }
2742
+
2743
+
2744
+ function loadDocuments(input, options) {
2745
+ input = String(input);
2746
+ options = options || {};
2747
+
2748
+ if (input.length !== 0) {
2749
+
2750
+ // Add tailing `\n` if not exists
2751
+ if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
2752
+ input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
2753
+ input += '\n';
2754
+ }
2755
+
2756
+ // Strip BOM
2757
+ if (input.charCodeAt(0) === 0xFEFF) {
2758
+ input = input.slice(1);
2759
+ }
2760
+ }
2761
+
2762
+ var state = new State$1(input, options);
2763
+
2764
+ var nullpos = input.indexOf('\0');
2765
+
2766
+ if (nullpos !== -1) {
2767
+ state.position = nullpos;
2768
+ throwError(state, 'null byte is not allowed in input');
2769
+ }
2770
+
2771
+ // Use 0 as string terminator. That significantly simplifies bounds check.
2772
+ state.input += '\0';
2773
+
2774
+ while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
2775
+ state.lineIndent += 1;
2776
+ state.position += 1;
2777
+ }
2778
+
2779
+ while (state.position < (state.length - 1)) {
2780
+ readDocument(state);
2781
+ }
2782
+
2783
+ return state.documents;
2784
+ }
2785
+
2786
+
2787
+ function load$1(input, options) {
2788
+ var documents = loadDocuments(input, options);
2789
+
2790
+ if (documents.length === 0) {
2791
+ /*eslint-disable no-undefined*/
2792
+ return undefined;
2793
+ } else if (documents.length === 1) {
2794
+ return documents[0];
2795
+ }
2796
+ throw new exception('expected a single document in the stream, but found more');
2797
+ }
2798
+ var load_1 = load$1;
2799
+
2800
+ var loader = {
2801
+ load: load_1
2802
+ };
2803
+ var load = loader.load;
2804
+
2805
+ const EPS = 1e-9;
2806
+ function toBoolString(v) {
2807
+ if (v == null)
2808
+ return undefined;
2809
+ if (typeof v === 'boolean')
2810
+ return v ? 'true' : 'false';
2811
+ const s = String(v).toLowerCase();
2812
+ if (s === 'true' || s === '1')
2813
+ return 'true';
2814
+ if (s === 'false' || s === '0')
2815
+ return 'false';
2816
+ return s;
2817
+ }
2818
+ function toNumOrUndef(v) {
2819
+ if (v == null)
2820
+ return undefined;
2821
+ const n = typeof v === 'number' ? v : Number(v);
2822
+ return Number.isFinite(n) ? n : undefined;
2823
+ }
2824
+ /** stable JSON for objects (key-sorted) */
2825
+ function stableStringify(obj) {
2826
+ if (obj == null)
2827
+ return undefined;
2828
+ if (typeof obj !== 'object')
2829
+ return JSON.stringify(obj);
2830
+ const keys = Object.keys(obj).sort();
2831
+ const acc = {};
2832
+ for (const k of keys)
2833
+ acc[k] = obj[k];
2834
+ return JSON.stringify(acc);
2835
+ }
2836
+ function eqNum(a, b) {
2837
+ if (a == null && b == null)
2838
+ return true;
2839
+ if (a == null || b == null)
2840
+ return false;
2841
+ return Math.abs(a - b) <= EPS;
2842
+ }
2843
+ function eqStr(a, b) {
2844
+ return (a ?? undefined) === (b ?? undefined);
2845
+ }
2846
+ /** Compare fields relevant for rendering; returns patch (only changed fields) */
2847
+ function diffRelevantFields(a, b) {
2848
+ const changes = {};
2849
+ if (a.type !== b.type)
2850
+ changes.type = { old: a.type, new: b.type };
2851
+ const aVisible = toBoolString(a.visible);
2852
+ const bVisible = toBoolString(b.visible);
2853
+ if (!eqStr(aVisible, bVisible))
2854
+ changes.visible = { old: aVisible, new: bVisible };
2855
+ const aOpacity = toNumOrUndef(a.opacity);
2856
+ const bOpacity = toNumOrUndef(b.opacity);
2857
+ if (!eqNum(aOpacity, bOpacity))
2858
+ changes.opacity = { old: aOpacity, new: bOpacity };
2859
+ const aZ = toNumOrUndef(a.zIndex);
2860
+ const bZ = toNumOrUndef(b.zIndex);
2861
+ if (!eqNum(aZ, bZ))
2862
+ changes.zIndex = { old: aZ, new: bZ };
2863
+ if (!eqStr(a.url, b.url))
2864
+ changes.url = { old: a.url, new: b.url };
2865
+ if (!eqStr(a.layers, b.layers))
2866
+ changes.layers = { old: a.layers, new: b.layers };
2867
+ const aTiled = toBoolString(a.tiled);
2868
+ const bTiled = toBoolString(b.tiled);
2869
+ if (!eqStr(aTiled, bTiled))
2870
+ changes.tiled = { old: aTiled, new: bTiled };
2871
+ const aStyle = stableStringify(a.style);
2872
+ const bStyle = stableStringify(b.style);
2873
+ if (!eqStr(aStyle, bStyle))
2874
+ changes.style = { old: a.style, new: b.style };
2875
+ const aData = stableStringify(a.data);
2876
+ const bData = stableStringify(b.data);
2877
+ if (!eqStr(aData, bData))
2878
+ changes.data = { old: a.data, new: b.data };
2879
+ return changes;
2880
+ }
2881
+ /** Longest Common Subsequence for stable move detection (by IDs) */
2882
+ function lcs(a, b) {
2883
+ const m = a.length, n = b.length;
2884
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
2885
+ for (let i = m - 1; i >= 0; i--) {
2886
+ for (let j = n - 1; j >= 0; j--) {
2887
+ dp[i][j] =
2888
+ a[i] === b[j]
2889
+ ? dp[i + 1][j + 1] + 1
2890
+ : Math.max(dp[i + 1][j], dp[i][j + 1]);
2891
+ }
2892
+ }
2893
+ const seq = [];
2894
+ let i = 0, j = 0;
2895
+ while (i < m && j < n) {
2896
+ if (a[i] === b[j]) {
2897
+ seq.push(a[i]);
2898
+ i++;
2899
+ j++;
2900
+ }
2901
+ else if (dp[i + 1][j] >= dp[i][j + 1])
2902
+ i++;
2903
+ else
2904
+ j++;
2905
+ }
2906
+ return seq;
2907
+ }
2908
+ /** Computes added/removed/updated/moved/unchanged */
2909
+ function diffLayers(oldLayers, newLayers) {
2910
+ const oldById = new Map(oldLayers.map(l => [l.id, l]));
2911
+ const newById = new Map(newLayers.map(l => [l.id, l]));
2912
+ const added = [];
2913
+ const removed = [];
2914
+ const updated = [];
2915
+ const unchangedIds = [];
2916
+ for (const newL of newLayers) {
2917
+ const oldL = oldById.get(newL.id);
2918
+ if (!oldL) {
2919
+ added.push(newL);
2920
+ continue;
2921
+ }
2922
+ const changes = diffRelevantFields(oldL, newL);
2923
+ if (Object.keys(changes).length)
2924
+ updated.push({ id: newL.id, changes });
2925
+ else
2926
+ unchangedIds.push(newL.id);
2927
+ }
2928
+ for (const oldL of oldLayers) {
2929
+ if (!newById.has(oldL.id))
2930
+ removed.push(oldL);
2931
+ }
2932
+ const oldIds = oldLayers.filter(l => newById.has(l.id)).map(l => l.id);
2933
+ const newIds = newLayers.filter(l => oldById.has(l.id)).map(l => l.id);
2934
+ const seq = lcs(oldIds, newIds);
2935
+ const keep = new Set(seq);
2936
+ const moved = [];
2937
+ for (const id of newIds) {
2938
+ if (!keep.has(id) && !added.find(a => a.id === id)) {
2939
+ const from = oldIds.indexOf(id);
2940
+ const to = newIds.indexOf(id);
2941
+ if (from !== -1 && to !== -1)
2942
+ moved.push({ id, from, to });
2943
+ }
2944
+ }
2945
+ return { added, removed, updated, moved, unchangedIds };
2946
+ }
2947
+
2948
+ const vMapBuilderCss = () => `:host{display:block;height:100%}.root{height:100%}`;
2949
+
2950
+ const MSG_COMPONENT = 'v-map-builder - ';
2951
+ const VMapBuilder = class {
2952
+ constructor(hostRef) {
2953
+ registerInstance(this, hostRef);
2954
+ this.configReady = createEvent(this, "configReady", 7);
2955
+ this.configError = createEvent(this, "configError", 7);
2956
+ }
2957
+ get hostEl() { return getElement(this); }
2958
+ /**
2959
+ * Configuration object for the map builder. Can be any structure that will be normalized to BuilderConfig.
2960
+ */
2961
+ mapconfig;
2962
+ /**
2963
+ * Event emitted when the map configuration has been successfully parsed and is ready to use.
2964
+ */
2965
+ configReady;
2966
+ /**
2967
+ * Event emitted when there is an error parsing the map configuration.
2968
+ */
2969
+ configError;
2970
+ current;
2971
+ //componentWillLoad() {
2972
+ async componentDidLoad() {
2973
+ log(MSG_COMPONENT + MESSAGES.COMPONENT_DID_LOAD);
2974
+ this.parseFromSlot();
2975
+ }
2976
+ async onMapConfigChanged(_oldValue, _newValue) {
2977
+ log(MSG_COMPONENT + 'onMapConfigChanged');
2978
+ this.parseFromSlot();
2979
+ }
2980
+ parseFromSlot() {
2981
+ log(MSG_COMPONENT + 'parseFromSlot');
2982
+ try {
2983
+ const script = this.hostEl.querySelector('script[type*="json"], script[type*="yaml"], script[type*="yml"]');
2984
+ if (!script)
2985
+ throw new Error('No configuration <script> found.');
2986
+ const mime = (script.type || '').toLowerCase();
2987
+ const text = script.textContent ?? '';
2988
+ const raw = mime.includes('json') ? JSON.parse(text) : load(text);
2989
+ const cfg = this.normalize(raw);
2990
+ this.applyDiff(this.current, cfg);
2991
+ this.current = cfg;
2992
+ log(MSG_COMPONENT + 'emit configReady');
2993
+ this.configReady.emit(cfg);
2994
+ }
2995
+ catch (e) {
2996
+ const err = e;
2997
+ const message = err?.message || 'Unknown error';
2998
+ this.configError.emit({
2999
+ message,
3000
+ errors: err?.errors,
3001
+ });
3002
+ this.hostEl.dispatchEvent(new CustomEvent(VMapEvents.Error, {
3003
+ detail: {
3004
+ type: 'validation',
3005
+ message,
3006
+ cause: e,
3007
+ },
3008
+ bubbles: true,
3009
+ composed: true,
3010
+ }));
3011
+ }
3012
+ }
3013
+ normalizeLayerType(rawType) {
3014
+ const type = String(rawType ?? '').toLowerCase();
3015
+ switch (type) {
3016
+ case 'osm':
3017
+ case 'wms':
3018
+ case 'wms-tiled':
3019
+ case 'geojson':
3020
+ case 'xyz':
3021
+ case 'terrain':
3022
+ case 'wfs':
3023
+ case 'wcs':
3024
+ case 'google':
3025
+ case 'geotiff':
3026
+ case 'tile3d':
3027
+ case 'scatterplot':
3028
+ case 'wkt':
3029
+ return type;
3030
+ default:
3031
+ return 'custom';
3032
+ }
3033
+ }
3034
+ toOptionalString(value) {
3035
+ if (value === undefined || value === null)
3036
+ return undefined;
3037
+ return typeof value === 'string' ? value : String(value);
3038
+ }
3039
+ toOptionalNumber(value) {
3040
+ if (value === undefined || value === null || value === '')
3041
+ return undefined;
3042
+ const num = typeof value === 'number' ? value : Number(value);
3043
+ return Number.isFinite(num) ? num : undefined;
3044
+ }
3045
+ toOptionalBoolean(value) {
3046
+ if (value === undefined || value === null || value === '')
3047
+ return undefined;
3048
+ if (typeof value === 'boolean')
3049
+ return value;
3050
+ const normalized = String(value).trim().toLowerCase();
3051
+ if (['true', '1', 'yes', 'y'].includes(normalized))
3052
+ return true;
3053
+ if (['false', '0', 'no', 'n'].includes(normalized))
3054
+ return false;
3055
+ return undefined;
3056
+ }
3057
+ toCsv(value) {
3058
+ if (value === undefined || value === null)
3059
+ return undefined;
3060
+ if (Array.isArray(value)) {
3061
+ return value
3062
+ .map(entry => this.toOptionalString(entry))
3063
+ .filter((entry) => entry != null && entry !== '')
3064
+ .join(',');
3065
+ }
3066
+ return this.toOptionalString(value);
3067
+ }
3068
+ cleanRecord(record) {
3069
+ if (!record)
3070
+ return undefined;
3071
+ const result = {};
3072
+ for (const [key, value] of Object.entries(record)) {
3073
+ if (value !== undefined && value !== null) {
3074
+ result[key] = value;
3075
+ }
3076
+ }
3077
+ return Object.keys(result).length ? result : undefined;
3078
+ }
3079
+ normalizeLayer(rawLayer, groupIndex, layerIndex) {
3080
+ const type = this.normalizeLayerType(rawLayer?.type ?? rawLayer?.layerType);
3081
+ const layerId = String(rawLayer?.id ?? `${groupIndex + 1}-${layerIndex + 1}`);
3082
+ const base = {
3083
+ id: layerId,
3084
+ type,
3085
+ visible: rawLayer?.visible,
3086
+ opacity: rawLayer?.opacity,
3087
+ zIndex: rawLayer?.zIndex,
3088
+ };
3089
+ if (rawLayer?.style != null) {
3090
+ base.style = rawLayer.style;
3091
+ }
3092
+ const data = {};
3093
+ const setBase = (key, value) => {
3094
+ if (value !== undefined && value !== null) {
3095
+ // NormalizedLayer has [key: string]: unknown index signature
3096
+ base[key] = value;
3097
+ }
3098
+ };
3099
+ switch (type) {
3100
+ case 'wms':
3101
+ case 'wms-tiled': {
3102
+ const url = this.toOptionalString(rawLayer?.url);
3103
+ const layers = this.toOptionalString(rawLayer?.layers ?? rawLayer?.sublayers);
3104
+ const tiled = type === 'wms-tiled'
3105
+ ? true
3106
+ : this.toOptionalBoolean(rawLayer?.tiled);
3107
+ setBase('url', url);
3108
+ setBase('layers', layers);
3109
+ if (tiled !== undefined)
3110
+ setBase('tiled', tiled);
3111
+ const params = rawLayer?.params ?? rawLayer?.extraParams;
3112
+ Object.assign(data, this.cleanRecord({
3113
+ styles: rawLayer?.styles,
3114
+ format: rawLayer?.format,
3115
+ transparent: this.toOptionalBoolean(rawLayer?.transparent),
3116
+ tiled,
3117
+ version: rawLayer?.version,
3118
+ time: rawLayer?.time,
3119
+ params,
3120
+ }) ?? {});
3121
+ break;
3122
+ }
3123
+ case 'geojson': {
3124
+ setBase('url', this.toOptionalString(rawLayer?.url));
3125
+ Object.assign(data, this.cleanRecord({
3126
+ geojson: rawLayer?.geojson ?? rawLayer?.data,
3127
+ fillColor: rawLayer?.fillColor,
3128
+ fillOpacity: this.toOptionalNumber(rawLayer?.fillOpacity),
3129
+ strokeColor: rawLayer?.strokeColor,
3130
+ strokeWidth: this.toOptionalNumber(rawLayer?.strokeWidth),
3131
+ strokeOpacity: this.toOptionalNumber(rawLayer?.strokeOpacity),
3132
+ pointRadius: this.toOptionalNumber(rawLayer?.pointRadius),
3133
+ pointColor: rawLayer?.pointColor,
3134
+ iconUrl: rawLayer?.iconUrl,
3135
+ iconSize: rawLayer?.iconSize,
3136
+ textProperty: rawLayer?.textProperty,
3137
+ textColor: rawLayer?.textColor,
3138
+ textSize: this.toOptionalNumber(rawLayer?.textSize),
3139
+ }) ?? {});
3140
+ break;
3141
+ }
3142
+ case 'xyz': {
3143
+ setBase('url', this.toOptionalString(rawLayer?.url));
3144
+ Object.assign(data, this.cleanRecord({
3145
+ attributions: rawLayer?.attributions,
3146
+ maxZoom: this.toOptionalNumber(rawLayer?.maxZoom),
3147
+ tileSize: this.toOptionalNumber(rawLayer?.tileSize),
3148
+ subdomains: this.toCsv(rawLayer?.subdomains),
3149
+ }) ?? {});
3150
+ break;
3151
+ }
3152
+ case 'terrain': {
3153
+ const nested = (rawLayer?.data != null && typeof rawLayer.data === 'object'
3154
+ ? rawLayer.data
3155
+ : {});
3156
+ Object.assign(data, this.cleanRecord({
3157
+ elevationData: rawLayer?.elevationData ??
3158
+ rawLayer?.url ??
3159
+ nested.elevationData,
3160
+ texture: rawLayer?.texture ?? nested.texture,
3161
+ elevationDecoder: rawLayer?.elevationDecoder ?? nested.elevationDecoder,
3162
+ wireframe: this.toOptionalBoolean(rawLayer?.wireframe ?? nested.wireframe),
3163
+ color: rawLayer?.color ?? nested.color,
3164
+ minZoom: this.toOptionalNumber(rawLayer?.minZoom ?? nested.minZoom),
3165
+ maxZoom: this.toOptionalNumber(rawLayer?.maxZoom ?? nested.maxZoom),
3166
+ meshMaxError: this.toOptionalNumber(rawLayer?.meshMaxError ?? nested.meshMaxError),
3167
+ }) ?? {});
3168
+ break;
3169
+ }
3170
+ case 'wfs': {
3171
+ const url = this.toOptionalString(rawLayer?.url);
3172
+ setBase('url', url);
3173
+ Object.assign(data, this.cleanRecord({
3174
+ url,
3175
+ typeName: rawLayer?.typeName ?? rawLayer?.layerName,
3176
+ version: rawLayer?.version,
3177
+ outputFormat: rawLayer?.outputFormat ?? rawLayer?.format,
3178
+ srsName: rawLayer?.srsName ?? rawLayer?.crs,
3179
+ params: rawLayer?.params,
3180
+ }) ?? {});
3181
+ break;
3182
+ }
3183
+ case 'wcs': {
3184
+ const url = this.toOptionalString(rawLayer?.url);
3185
+ setBase('url', url);
3186
+ Object.assign(data, this.cleanRecord({
3187
+ url,
3188
+ coverageName: rawLayer?.coverageName,
3189
+ format: rawLayer?.format,
3190
+ version: rawLayer?.version,
3191
+ projection: rawLayer?.projection,
3192
+ resolutions: rawLayer?.resolutions,
3193
+ params: rawLayer?.params,
3194
+ }) ?? {});
3195
+ break;
3196
+ }
3197
+ case 'google': {
3198
+ Object.assign(data, this.cleanRecord({
3199
+ apiKey: rawLayer?.apiKey ?? rawLayer?.api_key,
3200
+ mapType: rawLayer?.mapType,
3201
+ language: rawLayer?.language,
3202
+ region: rawLayer?.region,
3203
+ scale: rawLayer?.scale,
3204
+ libraries: this.toCsv(rawLayer?.libraries),
3205
+ maxZoom: this.toOptionalNumber(rawLayer?.maxZoom),
3206
+ styles: rawLayer?.styles,
3207
+ }) ?? {});
3208
+ break;
3209
+ }
3210
+ case 'geotiff': {
3211
+ setBase('url', this.toOptionalString(rawLayer?.url));
3212
+ break;
3213
+ }
3214
+ case 'tile3d': {
3215
+ setBase('url', this.toOptionalString(rawLayer?.url));
3216
+ Object.assign(data, this.cleanRecord({
3217
+ tilesetOptions: rawLayer?.tilesetOptions ?? rawLayer?.options ?? rawLayer?.data,
3218
+ style: rawLayer?.style ?? rawLayer?.cesiumStyle,
3219
+ }) ?? {});
3220
+ break;
3221
+ }
3222
+ case 'scatterplot': {
3223
+ Object.assign(data, this.cleanRecord({
3224
+ url: this.toOptionalString(rawLayer?.url),
3225
+ data: rawLayer?.data,
3226
+ getFillColor: rawLayer?.getFillColor,
3227
+ getRadius: this.toOptionalNumber(rawLayer?.getRadius),
3228
+ }) ?? {});
3229
+ break;
3230
+ }
3231
+ case 'wkt': {
3232
+ Object.assign(data, this.cleanRecord({
3233
+ wkt: rawLayer?.wkt,
3234
+ url: this.toOptionalString(rawLayer?.url),
3235
+ fillColor: rawLayer?.fillColor,
3236
+ fillOpacity: this.toOptionalNumber(rawLayer?.fillOpacity),
3237
+ strokeColor: rawLayer?.strokeColor,
3238
+ strokeWidth: this.toOptionalNumber(rawLayer?.strokeWidth),
3239
+ strokeOpacity: this.toOptionalNumber(rawLayer?.strokeOpacity),
3240
+ pointRadius: this.toOptionalNumber(rawLayer?.pointRadius),
3241
+ pointColor: rawLayer?.pointColor,
3242
+ iconUrl: rawLayer?.iconUrl,
3243
+ iconSize: rawLayer?.iconSize,
3244
+ textProperty: rawLayer?.textProperty,
3245
+ textColor: rawLayer?.textColor,
3246
+ textSize: this.toOptionalNumber(rawLayer?.textSize),
3247
+ }) ?? {});
3248
+ break;
3249
+ }
3250
+ case 'osm':
3251
+ setBase('url', this.toOptionalString(rawLayer?.url));
3252
+ break;
3253
+ default: {
3254
+ const payload = rawLayer?.data && typeof rawLayer.data === 'object'
3255
+ ? rawLayer.data
3256
+ : rawLayer;
3257
+ if (payload && typeof payload === 'object') {
3258
+ Object.assign(data, this.cleanRecord(payload) ?? {});
3259
+ }
3260
+ }
3261
+ }
3262
+ base.data = this.cleanRecord(data);
3263
+ return base;
3264
+ }
3265
+ normalize(raw) {
3266
+ const rawObj = (raw != null && typeof raw === 'object' ? raw : {});
3267
+ const map = (rawObj.map != null && typeof rawObj.map === 'object' ? rawObj.map : rawObj);
3268
+ const norm = {
3269
+ map: {
3270
+ flavour: String(map.flavour ?? 'ol'),
3271
+ id: String(map.id ?? 'map1'),
3272
+ zoom: Number(map.zoom ?? 2),
3273
+ center: String(map.center ?? '0,0'),
3274
+ style: String(map.style ?? ''),
3275
+ styles: this.normalizeStyles(map.styles),
3276
+ layerGroups: (Array.isArray(map.layerGroups) ? map.layerGroups : []).map((g, gi) => ({
3277
+ groupTitle: String(g.groupTitle ?? g.group ?? g.title ?? `Group ${gi + 1}`),
3278
+ basemapid: String(g.basemapid ?? ''),
3279
+ visible: g.visible,
3280
+ layers: (Array.isArray(g.layers) ? g.layers : []).map((l, li) => this.normalizeLayer(l, gi, li)),
3281
+ })),
3282
+ },
3283
+ };
3284
+ return norm;
3285
+ }
3286
+ normalizeStyles(input) {
3287
+ const list = Array.isArray(input) ? input : input ? [input] : [];
3288
+ return list
3289
+ .map((entry, index) => this.normalizeStyle(entry, index))
3290
+ .filter((style) => Boolean(style));
3291
+ }
3292
+ normalizeStyle(entry, index) {
3293
+ if (entry == null)
3294
+ return undefined;
3295
+ const raw = typeof entry === 'object' && entry !== null
3296
+ ? entry
3297
+ : { content: entry };
3298
+ const keySource = raw.key ?? raw.id ?? raw.name;
3299
+ const key = String(keySource != null ? keySource : `style-${index + 1}`);
3300
+ const format = String(raw.format ?? 'sld').toLowerCase();
3301
+ let layerTargets;
3302
+ if (Array.isArray(raw.layerTargets)) {
3303
+ const targets = raw.layerTargets
3304
+ .map((target) => String(target).trim())
3305
+ .filter(Boolean);
3306
+ layerTargets = targets.length ? targets.join(',') : undefined;
3307
+ }
3308
+ else if (typeof raw.layerTargets === 'string') {
3309
+ const targets = raw.layerTargets
3310
+ .split(',')
3311
+ .map(target => target.trim())
3312
+ .filter(Boolean);
3313
+ layerTargets = targets.length ? targets.join(',') : undefined;
3314
+ }
3315
+ const autoApply = raw.autoApply == null
3316
+ ? undefined
3317
+ : typeof raw.autoApply === 'boolean'
3318
+ ? raw.autoApply
3319
+ : String(raw.autoApply).toLowerCase() !== 'false';
3320
+ let src = raw.src != null ? String(raw.src).trim() : undefined;
3321
+ if (src === '')
3322
+ src = undefined;
3323
+ let content = raw.content != null ? String(raw.content) : undefined;
3324
+ if (!src && !content && typeof raw.source === 'string') {
3325
+ const source = raw.source.trim();
3326
+ if (source) {
3327
+ if (/^(https?:)?\/\//.test(source) ||
3328
+ source.startsWith('/') ||
3329
+ source.startsWith('./') ||
3330
+ source.startsWith('../')) {
3331
+ src = source;
3332
+ }
3333
+ else {
3334
+ content = source;
3335
+ }
3336
+ }
3337
+ }
3338
+ if (!src && !content) {
3339
+ if (typeof entry === 'string') {
3340
+ content = String(entry);
3341
+ }
3342
+ else {
3343
+ log(`${MSG_COMPONENT}normalizeStyle: skipping style without src/content (key=${key})`);
3344
+ return undefined;
3345
+ }
3346
+ }
3347
+ return {
3348
+ key,
3349
+ format,
3350
+ src,
3351
+ content,
3352
+ layerTargets,
3353
+ autoApply,
3354
+ id: raw.id != null ? String(raw.id) : undefined,
3355
+ };
3356
+ }
3357
+ syncStyles(mapEl, styles) {
3358
+ const selector = 'v-map-style[data-builder-style="true"]';
3359
+ const existing = Array.from(mapEl.querySelectorAll(selector));
3360
+ const existingByKey = new Map();
3361
+ for (const el of existing) {
3362
+ const key = el.getAttribute('data-builder-style-id');
3363
+ if (key)
3364
+ existingByKey.set(key, el);
3365
+ }
3366
+ const processed = new Set();
3367
+ const anchor = Array.from(mapEl.children).find(child => {
3368
+ if (child.tagName.toLowerCase() !== 'v-map-style')
3369
+ return true;
3370
+ return (child.getAttribute('data-builder-style') !== 'true');
3371
+ });
3372
+ styles.forEach((style, index) => {
3373
+ const key = style.key || `style-${index + 1}`;
3374
+ let el = existingByKey.get(key);
3375
+ if (!el || el.parentElement !== mapEl) {
3376
+ el = document.createElement('v-map-style');
3377
+ el.setAttribute('data-builder-style', 'true');
3378
+ el.setAttribute('data-builder-style-id', key);
3379
+ }
3380
+ else {
3381
+ el.setAttribute('data-builder-style', 'true');
3382
+ el.setAttribute('data-builder-style-id', key);
3383
+ }
3384
+ processed.add(key);
3385
+ this.ensureAttr(el, 'format', style.format);
3386
+ this.ensureAttr(el, 'layer-targets', style.layerTargets);
3387
+ if (style.autoApply !== undefined) {
3388
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- setting Stencil web component property
3389
+ el.autoApply = style.autoApply;
3390
+ }
3391
+ else {
3392
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- setting Stencil web component property
3393
+ el.autoApply = true;
3394
+ }
3395
+ const autoApplyAttr = style.autoApply === true ? '' : undefined;
3396
+ this.ensureAttr(el, 'auto-apply', autoApplyAttr);
3397
+ this.ensureAttr(el, 'id', style.id);
3398
+ this.ensureAttr(el, 'src', style.src);
3399
+ this.ensureAttr(el, 'content', style.content);
3400
+ const reference = anchor && anchor.parentElement === mapEl ? anchor : null;
3401
+ if (!el.isConnected || el.parentElement !== mapEl) {
3402
+ mapEl.insertBefore(el, reference);
3403
+ }
3404
+ else if (reference) {
3405
+ mapEl.insertBefore(el, reference);
3406
+ }
3407
+ });
3408
+ for (const el of existing) {
3409
+ const key = el.getAttribute('data-builder-style-id') || '';
3410
+ if (!processed.has(key)) {
3411
+ mapEl.removeChild(el);
3412
+ }
3413
+ }
3414
+ }
3415
+ ensureAttr(el, name, value) {
3416
+ const v = value == null ? undefined : String(value);
3417
+ const cur = el.getAttribute(name);
3418
+ if (v == null) {
3419
+ if (cur != null)
3420
+ el.removeAttribute(name);
3421
+ return;
3422
+ }
3423
+ if (cur !== v)
3424
+ el.setAttribute(name, v);
3425
+ }
3426
+ ensureGroup(mapEl, title, basemapid, visible, index) {
3427
+ let el = Array.from(mapEl.children).find(ch => ch.tagName.toLowerCase() === 'v-map-layergroup' &&
3428
+ ch.getAttribute('group-title') === title);
3429
+ if (!el) {
3430
+ el = document.createElement('v-map-layergroup');
3431
+ el.setAttribute('group-title', title);
3432
+ mapEl.insertBefore(el, (index != null ? mapEl.children[index] : null) || null);
3433
+ }
3434
+ this.ensureAttr(el, 'visible', visible);
3435
+ if (basemapid) {
3436
+ this.ensureAttr(el, 'basemapid', basemapid);
3437
+ }
3438
+ return el;
3439
+ }
3440
+ toKebabCase(value) {
3441
+ return value
3442
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
3443
+ .replace(/[\s_]+/g, '-')
3444
+ .toLowerCase();
3445
+ }
3446
+ createLayerEl(layer) {
3447
+ const data = (layer.data || {});
3448
+ const common = {
3449
+ id: layer.id,
3450
+ visible: layer.visible,
3451
+ opacity: layer.opacity,
3452
+ 'z-index': layer.zIndex,
3453
+ ...(layer.style ? { style: JSON.stringify(layer.style) } : {}),
3454
+ };
3455
+ const add = (attribute, value, opts) => {
3456
+ if (value === undefined || value === null)
3457
+ return;
3458
+ if (opts?.json && typeof value !== 'string') {
3459
+ try {
3460
+ common[attribute] = JSON.stringify(value);
3461
+ }
3462
+ catch {
3463
+ common[attribute] = String(value);
3464
+ }
3465
+ }
3466
+ else {
3467
+ common[attribute] = value;
3468
+ }
3469
+ };
3470
+ let el;
3471
+ switch (layer.type) {
3472
+ case 'osm':
3473
+ el = document.createElement('v-map-layer-osm');
3474
+ break;
3475
+ case 'wms':
3476
+ case 'wms-tiled': {
3477
+ el = document.createElement('v-map-layer-wms');
3478
+ add('url', layer.url ?? data.url);
3479
+ add('layers', layer.layers ?? data.layers);
3480
+ const tiledValue = layer.type === 'wms-tiled'
3481
+ ? true
3482
+ : data.tiled ?? layer.tiled ?? undefined;
3483
+ add('tiled', tiledValue);
3484
+ add('styles', data.styles);
3485
+ add('format', data.format);
3486
+ add('transparent', data.transparent);
3487
+ add('version', data.version);
3488
+ add('time', data.time);
3489
+ if (data.params)
3490
+ add('params', typeof data.params === 'string'
3491
+ ? data.params
3492
+ : JSON.stringify(data.params));
3493
+ break;
3494
+ }
3495
+ case 'geojson': {
3496
+ el = document.createElement('v-map-layer-geojson');
3497
+ add('url', layer.url ?? data.url);
3498
+ const geojsonPayload = data.geojson ?? data.data;
3499
+ if (geojsonPayload !== undefined) {
3500
+ add('geojson', typeof geojsonPayload === 'string'
3501
+ ? geojsonPayload
3502
+ : JSON.stringify(geojsonPayload));
3503
+ }
3504
+ add('fill-color', data.fillColor);
3505
+ add('fill-opacity', data.fillOpacity);
3506
+ add('stroke-color', data.strokeColor);
3507
+ add('stroke-width', data.strokeWidth);
3508
+ add('stroke-opacity', data.strokeOpacity);
3509
+ add('point-radius', data.pointRadius);
3510
+ add('point-color', data.pointColor);
3511
+ add('icon-url', data.iconUrl);
3512
+ add('icon-size', data.iconSize);
3513
+ add('text-property', data.textProperty);
3514
+ add('text-color', data.textColor);
3515
+ add('text-size', data.textSize);
3516
+ break;
3517
+ }
3518
+ case 'xyz': {
3519
+ el = document.createElement('v-map-layer-xyz');
3520
+ add('url', layer.url ?? data.url);
3521
+ add('attributions', data.attributions);
3522
+ add('max-zoom', data.maxZoom);
3523
+ add('tile-size', data.tileSize);
3524
+ add('subdomains', data.subdomains);
3525
+ break;
3526
+ }
3527
+ case 'terrain': {
3528
+ el = document.createElement('v-map-layer-terrain');
3529
+ add('elevation-data', data.elevationData);
3530
+ add('texture', data.texture);
3531
+ if (data.elevationDecoder)
3532
+ add('elevation-decoder', data.elevationDecoder, { json: typeof data.elevationDecoder !== 'string' });
3533
+ add('wireframe', data.wireframe);
3534
+ if (data.color) {
3535
+ add('color', Array.isArray(data.color) ? JSON.stringify(data.color) : data.color);
3536
+ }
3537
+ add('min-zoom', data.minZoom);
3538
+ add('max-zoom', data.maxZoom);
3539
+ add('mesh-max-error', data.meshMaxError);
3540
+ break;
3541
+ }
3542
+ case 'wfs': {
3543
+ el = document.createElement('v-map-layer-wfs');
3544
+ add('url', data.url ?? layer.url);
3545
+ add('type-name', data.typeName);
3546
+ add('version', data.version);
3547
+ add('output-format', data.outputFormat);
3548
+ add('srs-name', data.srsName);
3549
+ if (data.params)
3550
+ add('params', typeof data.params === 'string'
3551
+ ? data.params
3552
+ : JSON.stringify(data.params));
3553
+ break;
3554
+ }
3555
+ case 'wcs': {
3556
+ el = document.createElement('v-map-layer-wcs');
3557
+ add('url', data.url ?? layer.url);
3558
+ add('coverage-name', data.coverageName);
3559
+ add('format', data.format);
3560
+ add('version', data.version);
3561
+ add('projection', data.projection);
3562
+ if (data.resolutions)
3563
+ add('resolutions', typeof data.resolutions === 'string'
3564
+ ? data.resolutions
3565
+ : JSON.stringify(data.resolutions));
3566
+ if (data.params)
3567
+ add('params', typeof data.params === 'string'
3568
+ ? data.params
3569
+ : JSON.stringify(data.params));
3570
+ break;
3571
+ }
3572
+ case 'google': {
3573
+ el = document.createElement('v-map-layer-google');
3574
+ add('api-key', data.apiKey);
3575
+ add('map-type', data.mapType);
3576
+ add('language', data.language);
3577
+ add('region', data.region);
3578
+ add('scale', data.scale);
3579
+ add('libraries', data.libraries);
3580
+ add('max-zoom', data.maxZoom);
3581
+ if (data.styles)
3582
+ add('styles', typeof data.styles === 'string'
3583
+ ? data.styles
3584
+ : JSON.stringify(data.styles));
3585
+ break;
3586
+ }
3587
+ case 'geotiff': {
3588
+ el = document.createElement('v-map-layer-geotiff');
3589
+ add('url', layer.url ?? data.url);
3590
+ break;
3591
+ }
3592
+ case 'tile3d': {
3593
+ el = document.createElement('v-map-layer-tile3d');
3594
+ add('url', layer.url ?? data.url);
3595
+ if (data.tilesetOptions)
3596
+ add('tileset-options', typeof data.tilesetOptions === 'string'
3597
+ ? data.tilesetOptions
3598
+ : JSON.stringify(data.tilesetOptions));
3599
+ break;
3600
+ }
3601
+ case 'scatterplot': {
3602
+ el = document.createElement('v-map-layer-scatterplot');
3603
+ add('url', data.url);
3604
+ if (data.data)
3605
+ add('data', typeof data.data === 'string'
3606
+ ? data.data
3607
+ : JSON.stringify(data.data));
3608
+ add('get-fill-color', data.getFillColor);
3609
+ add('get-radius', data.getRadius);
3610
+ break;
3611
+ }
3612
+ case 'wkt': {
3613
+ el = document.createElement('v-map-layer-wkt');
3614
+ if (data.wkt)
3615
+ add('wkt', typeof data.wkt === 'string' ? data.wkt : JSON.stringify(data.wkt));
3616
+ add('url', data.url);
3617
+ add('fill-color', data.fillColor);
3618
+ add('fill-opacity', data.fillOpacity);
3619
+ add('stroke-color', data.strokeColor);
3620
+ add('stroke-width', data.strokeWidth);
3621
+ add('stroke-opacity', data.strokeOpacity);
3622
+ add('point-radius', data.pointRadius);
3623
+ add('point-color', data.pointColor);
3624
+ add('icon-url', data.iconUrl);
3625
+ add('icon-size', data.iconSize);
3626
+ add('text-property', data.textProperty);
3627
+ add('text-color', data.textColor);
3628
+ add('text-size', data.textSize);
3629
+ break;
3630
+ }
3631
+ default: {
3632
+ el = document.createElement('v-map-layer-custom');
3633
+ el.setAttribute('type', layer.type);
3634
+ if (data && typeof data === 'object') {
3635
+ for (const [key, value] of Object.entries(data)) {
3636
+ add(this.toKebabCase(key), typeof value === 'object' && value !== null
3637
+ ? JSON.stringify(value)
3638
+ : value);
3639
+ }
3640
+ }
3641
+ }
3642
+ }
3643
+ for (const [key, value] of Object.entries(common)) {
3644
+ this.ensureAttr(el, key, value);
3645
+ }
3646
+ return el;
3647
+ }
3648
+ patchLayer(el, patch, next) {
3649
+ for (const [field, change] of Object.entries(patch)) {
3650
+ const nv = change.new;
3651
+ switch (field) {
3652
+ case 'visible':
3653
+ this.ensureAttr(el, 'visible', nv);
3654
+ break;
3655
+ case 'opacity':
3656
+ this.ensureAttr(el, 'opacity', nv);
3657
+ break;
3658
+ case 'zIndex':
3659
+ this.ensureAttr(el, 'z-index', nv);
3660
+ break;
3661
+ case 'url':
3662
+ this.ensureAttr(el, 'url', nv);
3663
+ break;
3664
+ case 'layers':
3665
+ this.ensureAttr(el, 'layers', nv);
3666
+ break;
3667
+ case 'tiled':
3668
+ this.ensureAttr(el, 'tiled', nv);
3669
+ break;
3670
+ case 'style':
3671
+ this.ensureAttr(el, 'style', nv ? JSON.stringify(nv) : undefined);
3672
+ break;
3673
+ case 'data':
3674
+ if ([
3675
+ 'terrain',
3676
+ 'wfs',
3677
+ 'wcs',
3678
+ 'wms',
3679
+ 'wms-tiled',
3680
+ 'geojson',
3681
+ 'xyz',
3682
+ 'google',
3683
+ 'tile3d',
3684
+ 'scatterplot',
3685
+ 'wkt',
3686
+ ].includes(next.type)) {
3687
+ const parent = el.parentElement;
3688
+ const newEl = this.createLayerEl(next);
3689
+ parent.replaceChild(newEl, el);
3690
+ return;
3691
+ }
3692
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- custom web component method not in DOM typings
3693
+ el.setData?.(nv);
3694
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- custom web component method not in DOM typings
3695
+ if (!el.setData) {
3696
+ const s = typeof nv === 'object' ? JSON.stringify(nv) : nv;
3697
+ this.ensureAttr(el, 'data', s);
3698
+ }
3699
+ break;
3700
+ case 'type':
3701
+ const parent = el.parentElement;
3702
+ const newEl = this.createLayerEl(next);
3703
+ parent.replaceChild(newEl, el);
3704
+ return;
3705
+ }
3706
+ }
3707
+ }
3708
+ applyDiff(_prev, next) {
3709
+ const container = this.hostEl;
3710
+ let mapEl = Array.from(container.children).find(ch => ch.tagName.toLowerCase() === 'v-map');
3711
+ if (!mapEl) {
3712
+ mapEl = document.createElement('v-map');
3713
+ container.appendChild(mapEl);
3714
+ }
3715
+ this.ensureAttr(mapEl, 'flavour', next.map.flavour);
3716
+ this.ensureAttr(mapEl, 'id', next.map.id);
3717
+ this.ensureAttr(mapEl, 'zoom', String(next.map.zoom));
3718
+ this.ensureAttr(mapEl, 'center', next.map.center);
3719
+ this.ensureAttr(mapEl, 'style', next.map.style);
3720
+ this.syncStyles(mapEl, next.map.styles || []);
3721
+ const nextTitles = new Set(next.map.layerGroups.map(g => g.groupTitle));
3722
+ Array.from(mapEl.children).forEach(ch => {
3723
+ if (ch.tagName.toLowerCase() !== 'v-map-layergroup')
3724
+ return;
3725
+ const t = ch.getAttribute('group-title') || '';
3726
+ if (!nextTitles.has(t))
3727
+ mapEl.removeChild(ch);
3728
+ });
3729
+ next.map.layerGroups.forEach((group, gi) => {
3730
+ const groupEl = this.ensureGroup(mapEl, group.groupTitle, group.basemapid, group.visible, gi);
3731
+ const oldLayers = [];
3732
+ Array.from(groupEl.children).forEach(ch => {
3733
+ const id = ch.getAttribute('id') || '';
3734
+ const type = ch.tagName
3735
+ .toLowerCase()
3736
+ .replace('v-map-layer-', '');
3737
+ oldLayers.push({ id, type });
3738
+ });
3739
+ const { removed, updated, moved } = diffLayers(oldLayers, group.layers);
3740
+ for (const r of removed) {
3741
+ const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === r.id);
3742
+ if (el)
3743
+ groupEl.removeChild(el);
3744
+ }
3745
+ for (const m of moved) {
3746
+ const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === m.id);
3747
+ if (el)
3748
+ groupEl.insertBefore(el, groupEl.children[m.to] || null);
3749
+ }
3750
+ for (const u of updated) {
3751
+ const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === u.id);
3752
+ if (!el)
3753
+ continue;
3754
+ const nextLayer = group.layers.find(l => l.id === u.id);
3755
+ this.patchLayer(el, u.changes, nextLayer);
3756
+ }
3757
+ group.layers.forEach((l, idx) => {
3758
+ const exists = Array.from(groupEl.children).some(ch => ch.getAttribute('id') === l.id);
3759
+ if (!exists) {
3760
+ const el = this.createLayerEl(l);
3761
+ groupEl.insertBefore(el, groupEl.children[idx] || null);
3762
+ }
3763
+ });
3764
+ });
3765
+ }
3766
+ onSlotChange = () => {
3767
+ log(MSG_COMPONENT + 'onSlotChange');
3768
+ this.parseFromSlot();
3769
+ //this.observeAssignedNodes();
3770
+ //this.readGeoJsonFromSlot();
3771
+ };
3772
+ render() {
3773
+ log(MSG_COMPONENT + MESSAGES.COMPONENT_RENDER);
3774
+ return (h("div", { key: '0e041d9d068e0b31b1d1245888e8aa3668b22625', class: "root" }, h("slot", { key: '0141bfb2be32531f9673bc8d0759943dd7ac63b1', name: "mapconfig", onSlotchange: this.onSlotChange }), h("slot", { key: '2df1c8fe43ea7ee4db3fc57875f0cec126b1fa97' })));
3775
+ }
3776
+ static get watchers() { return {
3777
+ "mapconfig": [{
3778
+ "onMapConfigChanged": 0
3779
+ }]
3780
+ }; }
3781
+ };
3782
+ VMapBuilder.style = vMapBuilderCss();
3783
+
3784
+ export { VMapBuilder as v_map_builder };