define(["require","exports","tslib","./esriDelegate!esri/core/Collection","../../Validation","./MapProvider","./tools","./ArcGisApiVersion","../../Hooks","esri/layers/FeatureLayer"],function(e,i,r,s,t,a,d,y,o,u){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),u=r.__importDefault(u);n.prototype.execute=function(e,i,r){var a=d.featuresToArray(t.validation.exists("features",e.features)),o=t.validation.string("displayName",e.displayName,t.validation.never),n=t.validation.array("fields",e.fields,t.validation.never),l=r.create();return d.inline(l.load(),function(){var e,i=void 0;if(y.isArcGisApiVersion3x){if((e=n.filter(function(e){return"esriFieldTypeOID"===e.type})[0])&&e.name){var r=void 0;switch(a[0].geometry.type){case"point":case"multipoint":r="esriGeometryPoint";break;case"polygon":case"extent":r="esriGeometryPolygon";break;case"polyline":r="esriGeometryPolyline"}var t={geometryType:r,fields:n,objectIdField:e.name,drawingInfo:{renderer:{type:"simple",symbol:a[0].symbol}}},i=new u.default({layerDefinition:t,featureSet:{features:a,geometryType:r}},{id:o});l.map.addLayer(i)}return{layer:i}}return(e=n.filter(function(e){return"oid"===e.type})[0])&&e.name&&((t=new s.Collection).addMany(a),i=new u.default({fields:n,objectIdField:e.name,title:o,source:t}),l.view.map.add(i)),{layer:i}})},n.action="gcx:wf:arcgis::AddFeatureLayer",n.suite="gcx:wf:builtin",a=r.__decorate([o.activate(a.MapProvider)],n);function n(){}i.AddFeatureLayer=a});