define(["require","exports","tslib","../../Errors","../../Validation","./tools","./ArcGisApiVersion","esri/request"],function(t,e,n,r,s,d,c,u){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),u=n.__importDefault(u);i.prototype.execute=function(t,e){var n,i=s.validation.urlOrLayer(t,c.isArcGisApiVersion3x).trim(),a=s.validation.number("objectId",t.objectId,s.validation.never),o=s.validation.exists("attachmentIds",t.attachment,s.validation.never),t=s.validation.number("timeout",t.timeout,void 0),i=d.addToPath(i,a+"/addAttachment"),a=new FormData;return a.append("attachment",o),a.append("f","json"),n=c.isArcGisApiVersion3x?u.default(n={url:i,form:a,handleAs:"json",timeout:t},{usePost:!0}):(n={method:"post",body:a,responseType:"json",timeout:t,cacheBust:!1},d.isAbortable(e.cancellationToken)&&(n.signal=e.cancellationToken.signal),u.default(i,n).then(function(t){return t.data})),d.schedulePromiseCancellation(e,n),d.inline(n,function(t){t=t.addAttachmentResult;if(!t)throw new r.GenericActivityError('Error running the "Add Attachment" activity. The response did not include the required "addAttachmentResult" property.');return{result:t}})},i.action="gcx:wf:arcgis::AddAttachment",i.suite="gcx:wf:builtin",n=i;function i(){}e.AddAttachment=n});