function $AdfRestDataService$$() {
  this.Init();
}
$goog$exportSymbol$$("AdfRestDataService", $AdfRestDataService$$);
$AdfObject$$.$createSubclass$($AdfRestDataService$$);
$AdfRestDataService$$.$InitClass$ = function $$AdfRestDataService$$$$InitClass$$() {
  this.$SUCCESS_CALLBACK_KEY$ = "success";
  $goog$exportSymbol$$("AdfRestDataService.SUCCESS_CALLBACK_KEY", $AdfRestDataService$$.$SUCCESS_CALLBACK_KEY$);
  this.$ERROR_CALLBACK_KEY$ = "error";
  $goog$exportSymbol$$("AdfRestDataService.ERROR_CALLBACK_KEY", $AdfRestDataService$$.$ERROR_CALLBACK_KEY$);
  this.$PRIORITIZE$ = "priority";
  $goog$exportSymbol$$("AdfRestDataService.PRIORITIZE", $AdfRestDataService$$.$PRIORITIZE$);
  this.$CLIENT_ID_KEY$ = "clientId";
  $goog$exportSymbol$$("AdfRestDataService.CLIENT_ID_KEY", $AdfRestDataService$$.$CLIENT_ID_KEY$);
  this.$REQUEST_DATA$ = "request";
  $goog$exportSymbol$$("AdfRestDataService.REQUEST_DATA", $AdfRestDataService$$.$REQUEST_DATA$);
};
$goog$exportSymbol$$("AdfRestDataService.InitClass", $AdfRestDataService$$.$InitClass$);
$AdfRestDataService$$.prototype.Init = function $$AdfRestDataService$$$$Init$() {
  $AdfRestDataService$$.$superclass$.Init.call(this);
  this.$_requestQueueManager$ = new $AdfRestRequestQueueManager$$;
  this.$_poolManager$ = new $AdfXhrPoolManager$$(this.$_requestQueueManager$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfRestDataService.prototype.Init", {Init:$AdfRestDataService$$.prototype.Init});
$AdfRestDataService$$.$normalizeUrl$ = function $$AdfRestDataService$$$$normalizeUrl$$($url$$30$$, $queryString$$) {
  $AdfAssert$$.$assertString$($url$$30$$);
  $url$$30$$ = $url$$30$$.trim();
  $url$$30$$ = $AdfRestDataService$$.$_removeHash$($url$$30$$);
  $url$$30$$ = $AdfRestDataService$$.$__removeTrailingSlashQuestionMarkAmpersand$($url$$30$$);
  $url$$30$$ = $AdfRestDataService$$.$_appendAndMergeQueryString$($url$$30$$, $queryString$$);
  $url$$30$$ = $AdfRestDataService$$.$_sortQueryParams$($url$$30$$);
  $AdfRestDataService$$.$isRelativeUrl$($url$$30$$) && ($url$$30$$ = $AdfAgent$$.$AGENT$.$getOrigin$() + $url$$30$$);
  return $url$$30$$;
};
$goog$exportSymbol$$("AdfRestDataService.normalizeUrl", $AdfRestDataService$$.$normalizeUrl$);
$AdfRestDataService$$.prototype.$isBusy$ = function $$AdfRestDataService$$$$$isBusy$$() {
  return this.$_requestQueueManager$.$hasOutstandingPriorityRequests$() || this.$_poolManager$.$hasDispatchedPriorityRequests$();
};
$AdfObject$$.$exportPrototypeSymbol$("AdfRestDataService.prototype.isBusy", {$isBusy$:$AdfRestDataService$$.prototype.$isBusy$});
$AdfRestDataService$$.$isRelativeUrl$ = function $$AdfRestDataService$$$$isRelativeUrl$$($url$$31$$) {
  return -1 == $url$$31$$.indexOf("://");
};
$goog$exportSymbol$$("AdfRestDataService.isRelativeUrl", $AdfRestDataService$$.$isRelativeUrl$);
$AdfRestDataService$$.prototype.$queueRequest$ = function $$AdfRestDataService$$$$$queueRequest$$($actionURL$$8$$, $options$$6$$) {
  $options$$6$$ = $AdfRestDataService$$.$_initializeOptions$($options$$6$$);
  $actionURL$$8$$ = $AdfRestDataService$$.$normalizeUrl$($actionURL$$8$$, $options$$6$$[$AdfRestDataService$$.$REQUEST_DATA$].$queryString$);
  this.$_requestQueueManager$.push($actionURL$$8$$, $options$$6$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfRestDataService.prototype.queueRequest", {$queueRequest$:$AdfRestDataService$$.prototype.$queueRequest$});
$AdfRestDataService$$.prototype.$__xhrCallback$ = function $$AdfRestDataService$$$$$__xhrCallback$$($request$$8$$, $optionKey$$, $callbackArgs$$) {
  for (var $options$$7$$ = $request$$8$$.options, $i$$116$$ = 0;$i$$116$$ < $options$$7$$.length;$i$$116$$++) {
    var $option$$2$$ = $options$$7$$[$i$$116$$], $callback$$81$$ = $option$$2$$[$optionKey$$];
    if ($callback$$81$$) {
      $AdfAssert$$.$assertFunction$($callback$$81$$);
      try {
        var $args$$183$$ = $callbackArgs$$.slice();
        $args$$183$$.push($option$$2$$);
        $callback$$81$$.apply(this, $args$$183$$);
      } catch ($exe$$) {
        $AdfLogger$$.$LOGGER$.severe("Exception ocurred while invoking '" + $optionKey$$ + "' callback for the URL '" + $request$$8$$.$actionURL$ + "'.", $exe$$);
      }
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfRestDataService.prototype.__xhrCallback", {$__xhrCallback$:$AdfRestDataService$$.prototype.$__xhrCallback$});
$AdfRestDataService$$.$_appendAndMergeQueryString$ = function $$AdfRestDataService$$$$_appendAndMergeQueryString$$($url$$32$$, $queryString$$2$$) {
  if (!$queryString$$2$$) {
    return $url$$32$$;
  }
  var $queryIndex$$2$$ = $url$$32$$.indexOf("?");
  if (-1 == $queryIndex$$2$$) {
    return $url$$32$$ + "?" + $queryString$$2$$;
  }
  for (var $existingQueryStringArr$$ = $url$$32$$.substring($queryIndex$$2$$ + 1).split("\x26"), $appendableQueryStringArr$$ = $queryString$$2$$.split("\x26"), $newQueryString$$ = "", $i$$117$$ = 0, $len1$$ = $existingQueryStringArr$$.length;$i$$117$$ < $len1$$;$i$$117$$++) {
    for (var $paramName$$ = $existingQueryStringArr$$[$i$$117$$].split("\x3d")[0], $j$$11$$ = 0;$j$$11$$ < $appendableQueryStringArr$$.length;$j$$11$$++) {
      if (0 == $appendableQueryStringArr$$[$j$$11$$].indexOf($paramName$$)) {
        $existingQueryStringArr$$[$i$$117$$] = $appendableQueryStringArr$$[$j$$11$$];
        $appendableQueryStringArr$$.splice($j$$11$$, 1);
        break;
      }
    }
    $newQueryString$$ += $existingQueryStringArr$$[$i$$117$$] + "\x26";
  }
  $i$$117$$ = 0;
  for ($len1$$ = $appendableQueryStringArr$$.length;$i$$117$$ < $len1$$;$i$$117$$++) {
    $newQueryString$$ += $appendableQueryStringArr$$[$i$$117$$] + "\x26";
  }
  return $AdfRestDataService$$.$__removeTrailingSlashQuestionMarkAmpersand$($url$$32$$.substring(0, $queryIndex$$2$$ + 1) + $newQueryString$$);
};
$AdfRestDataService$$.$_initializeOptions$ = function $$AdfRestDataService$$$$_initializeOptions$$($options$$8$$) {
  $options$$8$$ || ($options$$8$$ = {});
  var $requestData$$ = $options$$8$$[$AdfRestDataService$$.$REQUEST_DATA$];
  $requestData$$ || ($requestData$$ = {method:"GET"});
  $options$$8$$[$AdfRestDataService$$.$REQUEST_DATA$] = $requestData$$;
  $options$$8$$[$AdfRestDataService$$.$PRIORITIZE$] = 1 == $options$$8$$[$AdfRestDataService$$.$PRIORITIZE$];
  return $options$$8$$;
};
$AdfRestDataService$$.$__removeTrailingSlashQuestionMarkAmpersand$ = function $$AdfRestDataService$$$$__removeTrailingSlashQuestionMarkAmpersand$$($url$$33$$) {
  var $oldUrl$$;
  do {
    $oldUrl$$ = $url$$33$$, $url$$33$$ = $url$$33$$.replace(/[\/\?&]+$/, "");
  } while ($oldUrl$$ != $url$$33$$);
  return $url$$33$$;
};
$AdfRestDataService$$.$_removeHash$ = function $$AdfRestDataService$$$$_removeHash$$($url$$34$$) {
  -1 != $url$$34$$.indexOf("#") && ($url$$34$$ = $url$$34$$.substring(0, $url$$34$$.indexOf("#")));
  return $url$$34$$;
};
$AdfRestDataService$$.$_sortQueryParams$ = function $$AdfRestDataService$$$$_sortQueryParams$$($url$$35$$) {
  var $queryIndex$$3$$ = $url$$35$$.indexOf("?");
  if (-1 == $queryIndex$$3$$) {
    return $url$$35$$;
  }
  for (var $sortedSearchStrArr$$ = $url$$35$$.substring($queryIndex$$3$$ + 1).split("\x26").sort(), $sortedSearchStr$$ = "", $i$$118$$ = 0, $length$$34$$ = $sortedSearchStrArr$$.length;$i$$118$$ < $length$$34$$;$i$$118$$++) {
    $sortedSearchStr$$ += $sortedSearchStrArr$$[$i$$118$$] + "\x26";
  }
  $sortedSearchStr$$ = $sortedSearchStr$$.replace(/&$/, "");
  return $url$$35$$.substring(0, $queryIndex$$3$$ + 1) + $sortedSearchStr$$;
};
