"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5621],{16869:function(e,t,r){var s=r(40890),n=r(41376),a=r(95783),o=r(54354),i=r(31998),c=r(61038),u=r(52110),l=r(64498),d=r(12174),p=r(41372),v=r(42010),f=r(19352),g=r(12810),m=r(2383),w="https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/",y=new s.Z,R=new a.Z({loader:function(e,t,r){var s=w+"2/query/?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry="+encodeURIComponent('{"xmin":'+e[0]+',"ymin":'+e[1]+',"xmax":'+e[2]+',"ymax":'+e[3]+',"spatialReference":{"wkid":102100}}')+"&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*&outSR=102100";$.ajax({url:s,dataType:"jsonp",success:function(e){if(e.error)alert(e.error.message+"\n"+e.error.details.join("\n"));else{var t=y.readFeatures(e,{featureProjection:r});t.length>0&&R.addFeatures(t)}}})},strategy:(0,m.Gg)((0,f.dl)({tileSize:512}))}),j=new p.Z({source:R}),h=new v.Z({source:new i.Z({attributions:'Tiles © ArcGIS',url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}"})}),S=new c.ZP({source:R,type:"Polygon"}),F=new u.Z;F.setActive(!1);var I=F.getFeatures(),Z=new l.Z({features:I});Z.setActive(!1);var A=new n.Z({interactions:(0,d.ce)().extend([S,F,Z]),layers:[h,j],target:document.getElementById("map"),view:new o.ZP({center:(0,g.mi)([-110.875,37.345]),zoom:5})}),P=document.getElementById("type");P.onchange=function(){S.setActive("DRAW"===P.value),F.setActive("MODIFY"===P.value),Z.setActive("MODIFY"===P.value)};var b={};I.on("add",(function(e){e.element.on("change",(function(e){b[e.target.get("objectid")]=!0}))})),I.on("remove",(function(e){var t=e.element,r=t.get("objectid");if(!0===b[r]){var s="["+y.writeFeature(t,{featureProjection:A.getView().getProjection()})+"]";$.post("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/2/updateFeatures",{f:"json",features:s}).done((function(e){var t="string"==typeof e?JSON.parse(e):e;if(t.updateResults&&t.updateResults.length>0)if(!0!==t.updateResults[0].success){var s=t.updateResults[0].error;alert(s.description+" ("+s.code+")")}else delete b[r]}))}})),S.on("drawend",(function(e){var t=e.feature,r="["+y.writeFeature(t,{featureProjection:A.getView().getProjection()})+"]";$.post("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/2/addFeatures",{f:"json",features:r}).done((function(e){var r="string"==typeof e?JSON.parse(e):e;if(r.addResults&&r.addResults.length>0)if(!0===r.addResults[0].success)t.set("objectid",r.addResults[0].objectId);else{var s=r.addResults[0].error;alert(s.description+" ("+s.code+")")}}))}))}},function(e){var t=function(t){return e(e.s=t)};t(9877),t(16869)}]); //# sourceMappingURL=vector-esri-edit.js.map