!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","./esriDelegate!esri/core/Collection","../../Validation","./MapProvider","./tools","./ArcGisApiVersion","../../Hooks","esri/layers/FeatureLayer"],e)}(function(e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("tslib"),s=e("./esriDelegate!esri/core/Collection"),t=e("../../Validation"),o=e("./MapProvider"),d=e("./tools"),y=e("./ArcGisApiVersion"),a=e("../../Hooks"),c=r.__importDefault(e("esri/layers/FeatureLayer")),o=(n.prototype.execute=function(e,i,r){var o=d.featuresToArray(t.validation.exists("features",e.features)),a=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(o[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:o[0].symbol}}},i=new c.default({layerDefinition:t,featureSet:{features:o,geometryType:r}},{id:a});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(o),i=new c.default({fields:n,objectIdField:e.name,title:a,source:t}),l.view.map.add(i)),{layer:i}})},n.action="gcx:wf:arcgis::AddFeatureLayer",n.suite="gcx:wf:builtin",r.__decorate([a.activate(o.MapProvider)],n));function n(){}i.AddFeatureLayer=o});