define(["require","exports","tslib","../../deps/bluebird_fork","../../Validation","./tools"],function(i,e,n,f,s,c){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),f=n.__importDefault(f);t.prototype.execute=function(i,e){var n=s.validation.exists("layer",i.layer,void 0),t=s.validation.exists("layerInfo",i.layerInfo,void 0),o=s.validation.string("type",i.type,void 0),a=s.validation.string("field",i.field,void 0),r=s.validation.string("url",i.url,void 0),l=s.validation.number("timeout",i.timeout,void 0),u={};i.dynamicLayerDefinition?u.layer=i.dynamicLayerDefinition:i.source&&(u.layer={source:i.source});t=t||n,t=r?c.fetch(r,u,l,e.cancellationToken.signal):f.default.resolve(t);function d(i){i=i.fields;if(i instanceof Array)for(var e=0,n=i;e<n.length;e++){var t=n[e];if(t.name===a){t=t.domain;if(null!=t)if(t.codedValues instanceof Array)return{domain:t}}}return{}}return c.schedulePromiseCancellation(e,t),c.inline(t,function(i){return null!=i?(void 0!==o?function(i){var e=i.types;if(e instanceof Array)for(var n=0,t=e;n<t.length;n++){var r=t[n];if(r.id===o){r=r.domains;if(null!=r){r=r[a];if(null!=r){if(r.codedValues instanceof Array)return{domain:r};if("inherited"===r.type)return d(i)}}return{}}}return{}}:d)(i):{}})},t.action="gcx:wf:arcgis::GetCodedValueDomain",t.suite="gcx:wf:builtin",n=t;function t(){}e.GetCodedValueDomain=n});