text: ﻿'use strict';
  /** @namespace DevKit */
  var DevKit;
  (function (DevKit) {
  	'use strict';
  	DevKit.RibbonTabToCommandMapApi = function (e) {
  		var EMPTY_STRING = '';
  		var f = '@OData.Community.Display.V1.FormattedValue';
          function webApiField(entity, logicalName, schemaName, entityLogicalCollectionName, entityLogicalName, readOnly, upsertEntity, isMultiOptionSet) {
              var l = '@Microsoft.Dynamics.CRM.lookuplogicalname';
              var property = {};
              var getFormattedValue = function () {
                  if (entity[logicalName + f] === undefined || entity[logicalName + f] === null) {
                      return EMPTY_STRING;
                  }
                  if (entityLogicalCollectionName !== undefined && entityLogicalCollectionName.length > 0) {
                      if (entity[logicalName + l] === entityLogicalName) {
                          return entity[logicalName + f];
                      }
                      return EMPTY_STRING;
                  }
                  if (isMultiOptionSet) {
                      return entity[logicalName + f].toString().split(';').map(function (item) { return item.trim(); });
                  }
                  return entity[logicalName + f];
              };
              var getValue = function () {
                  if (entity[logicalName] === undefined || entity[logicalName] === null) {
                      return null;
                  }
                  if (entityLogicalCollectionName !== undefined && entityLogicalCollectionName.length > 0) {
                      if (entity[logicalName + l] === undefined || entity[logicalName + l] === entityLogicalName) {
                          return entity[logicalName];
                      }
                      return null;
                  }
                  if (isMultiOptionSet) {
                      return entity[logicalName].toString().split(',').map(function (item) { return parseInt(item, 10); });
                  }
                  return entity[logicalName];
              };
              var setValue = function (value) {
                  if (isMultiOptionSet) value = value.join(',');
                  if (entityLogicalCollectionName !== undefined && entityLogicalCollectionName.length > 0) {
                      value = value.replace('{', EMPTY_STRING).replace('}', EMPTY_STRING);
                      upsertEntity[schemaName + '@odata.bind'] = '/' + entityLogicalCollectionName + '(' + value + ')';
                  } else {
                      upsertEntity[logicalName] = value;
                  }
                  entity[logicalName] = value;
              };
              Object.defineProperty(property, 'FormattedValue', {
                  get: getFormattedValue
              });
              if (readOnly) {
                  Object.defineProperty(property, 'Value', {
                      get: getValue
                  });
              }
              else {
                  Object.defineProperty(property, 'Value', {
                      get: getValue,
                      set: setValue
                  });
              }
              return property;
          }
  		var ribbontabtocommandmap = {
  			Command: { a: 'command' },
  			ComponentState: { a: 'componentstate', r: true },
  			ControlId: { a: 'controlid' },
  			Entity: { a: 'entity' },
  			IsManaged: { a: 'ismanaged', r: true },
  			OrganizationId: { b: 'organizationid', a: '_organizationid_value', c: 'organizations', d: 'organization', r: true },
  			OverwriteTime_UtcDateOnly: { a: 'overwritetime', r: true },
  			RibbonDiffId: { b: 'ribbondiffid', a: '_ribbondiffid_value', c: 'ribbondiffs', d: 'ribbondiff' },
  			RibbonTabToCommandMapId: { a: 'ribbontabtocommandmapid' },
  			RibbonTabToCommandMapUniqueId: { a: 'ribbontabtocommandmapuniqueid', r: true },
  			SolutionId: { a: 'solutionid', r: true },
  			SupportingSolutionId: { a: 'supportingsolutionid', r: true },
  			TabId: { a: 'tabid' },
  			VersionNumber: { a: 'versionnumber', r: true }
  		};
  		if (e === undefined) e = {};
  		var u = {};
  		for (var field in ribbontabtocommandmap) {
  			var a = ribbontabtocommandmap[field].a;
  			var b = ribbontabtocommandmap[field].b;
  			var c = ribbontabtocommandmap[field].c;
  			var d = ribbontabtocommandmap[field].d;
  			var g = ribbontabtocommandmap[field].g;
  			var r = ribbontabtocommandmap[field].r;
  			ribbontabtocommandmap[field] = webApiField(e, a, b, c, d, r, u, g);
  		}
  		ribbontabtocommandmap.Entity = u;
  		ribbontabtocommandmap.EntityName = 'ribbontabtocommandmap';
  		ribbontabtocommandmap.EntityCollectionName = 'ribbontabtocommandmaps';
  		ribbontabtocommandmap['@odata.etag'] = e['@odata.etag'];
  		ribbontabtocommandmap.getAliasedValue = function (alias, isMultiOptionSet) {
  			if (e[alias] === undefined || e[alias] === null) {
  				return null;
  			}
  			if (isMultiOptionSet) {
  				return e[alias].toString().split(',').map(function (item) { return parseInt(item, 10); });
  			}
  			return e[alias];
  		}
  		ribbontabtocommandmap.getAliasedFormattedValue = function (alias, isMultiOptionSet) {
  			if (e[alias + f] === undefined || e[alias + f] === null) {
  				return EMPTY_STRING;
  			}
  			if (isMultiOptionSet) {
  				return e[alias + f].toString().split(';').map(function (item) { return item.trim(); });
  			}
  			return e[alias + f];
  		}
  		return ribbontabtocommandmap;
  	};
  })(DevKit || (DevKit = {}));
  /** @namespace OptionSet */
  var OptionSet;
  (function (OptionSet) {
  	OptionSet.RibbonTabToCommandMap = {
  		ComponentState : {
  			Deleted: 2,
  			Deleted_Unpublished: 3,
  			Published: 0,
  			Unpublished: 1
  		},
          RollupState : {
              NotCalculated: 0,
              Calculated: 1,
              OverflowError: 2,
              OtherError: 3,
              RetryLimitExceeded: 4,
              HierarchicalRecursionLimitReached: 5,
              LoopDetected: 6
          }
  
  	};
  })(OptionSet || (OptionSet = {}));