!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","./esriDelegate!esri/tasks/support/RelationParameters","../../Validation","./tools","esri/tasks/GeometryService"],e)}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("tslib"),a=e("./esriDelegate!esri/tasks/support/RelationParameters"),s=e("../../Validation"),l=e("./tools"),c=i.__importDefault(e("esri/tasks/GeometryService")),e=(r.prototype.execute=function(e,t){var i=s.validation.exists("url",e.url,s.validation.never),r=new a.RelationParameters,n=r.geometries1=s.validation.array("geometry1",e.geometry1,s.validation.never),o=r.geometries2=s.validation.array("geometry2",e.geometry2,s.validation.never),e=s.validation.string("relation",e.relation,"intersection");e.match(/^[TF012\*]{9}$/)?(r.relation="esriGeometryRelationRelation",r.relationParam='RELATE(G1,G2,"'+e+'")'):r.relation=this.getEsriGeometryRelation(e);e=new c.default(i),i=l.isAbortable(t.cancellationToken)?{signal:t.cancellationToken.signal}:void 0,i=e.relation(r,i);return l.schedulePromiseCancellation(t,i),l.inline(i,function(e){e=e.map(function(e){return[n[e.geometry1Index],o[e.geometry2Index]]});return{incident:e[0],incidents:e}})},r.prototype.getEsriGeometryRelation=function(e){switch(e){case"cross":return"esriGeometryRelationCross";case"disjoint":return"esriGeometryRelationDisjoint";case"in":return"esriGeometryRelationIn";case"interior-intersection":return"esriGeometryRelationInteriorIntersection";case"intersection":return"esriGeometryRelationIntersection";case"line-coincidence":return"esriGeometryRelationLineCoincidence";case"line-touch":return"esriGeometryRelationLineTouch";case"overlap":return"esriGeometryRelationOverlap";case"point-touch":return"esriGeometryRelationPointTouch";case"touch":return"esriGeometryRelationTouch";case"within":return"esriGeometryRelationWithin";default:return e}},r.action="gcx:wf:arcgis::RelationServiceTask",r.suite="gcx:wf:builtin",r);function r(){}t.RelationServiceTask=e});