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