{"version":3,"file":"8086.64b291c9bca3f720ab62.js","mappings":"gKAIA,cAAsBA,EAAWC,KAC/B,IAAIC,EAAa,EACjBC,OAAOC,QAAQH,EAAsBI,QAAQC,SAAQ,EAAEC,EAAKC,MAC1D,IAEE,MAAMC,EAAQ,IAAI,UAAc,CAC9BC,IAAKF,EAAME,IACXC,MAAOJ,EACPK,QAASJ,EAAMK,cACfC,QAASN,EAAMM,UAIjBd,EAAUe,IAAIC,IAAIP,EAAOP,GACzBA,IACA,MACE,IAAyB,MAAnBO,EAAMQ,YACXC,MAAK,KACJC,OAAOC,MAAM,uBAAyBb,EAAK,GAGjD,CACA,MACEY,OAAOC,MAAM,uBAAyBb,EACxC,IAIH,C","sources":["webpack://wingismaps/./src/general/addLayers.js"],"sourcesContent":["// ES6 Import\r\nimport MapImageLayer from \"@arcgis/core/layers/MapImageLayer.js\";\r\nimport * as reactiveUtils from \"@arcgis/core/core/reactiveUtils.js\";\r\n\r\nexport default async (WinGISMap, conditionalMapOptions) => {\r\n let layerCount = 1; \r\n Object.entries(conditionalMapOptions.layers).forEach(([key, value]) => {\r\n try {\r\n // Create and add each layer asynchronously\r\n const layer = new MapImageLayer({\r\n url: value.url,\r\n title: key,\r\n visible: value.visibleOnLoad,\r\n opacity: value.opacity,\r\n });\r\n \r\n // Adding layer to the map, the addition process is independent and asynchronous\r\n WinGISMap.map.add(layer, layerCount);\r\n layerCount++; \r\n reactiveUtils.whenOnce(\r\n () => layer.loadError != null)\r\n .then(() => {\r\n window.alert(\"Error loading layer \" + key );\r\n });\r\n\r\n }\r\n catch {\r\n window.alert(\"Error loading layer \" + key );\r\n }\r\n });\r\n\r\n // Program flow continues immediately without waiting for layers to be added\r\n};\r\n"],"names":["WinGISMap","conditionalMapOptions","layerCount","Object","entries","layers","forEach","key","value","layer","url","title","visible","visibleOnLoad","opacity","map","add","loadError","then","window","alert"],"sourceRoot":""}