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