function $AdfScriptLoadingService$$($domWindow$$134$$, $domDocument$$78$$, $policy$$1$$) {
  this.Init($domWindow$$134$$, $domDocument$$78$$, $policy$$1$$);
}
$goog$exportSymbol$$("AdfScriptLoadingService", $AdfScriptLoadingService$$);
$AdfObject$$.$createSubclass$($AdfScriptLoadingService$$);
$AdfScriptLoadingService$$.$InitClass$ = function $$AdfScriptLoadingService$$$$InitClass$$() {
  this.$POLICY_SAME_ORIGIN$ = "sameOrigin";
  $goog$exportSymbol$$("AdfScriptLoadingService.POLICY_SAME_ORIGIN", $AdfScriptLoadingService$$.$POLICY_SAME_ORIGIN$);
  this.$POLICY_CROSS_ORIGIN$ = "crossOrigin";
  $goog$exportSymbol$$("AdfScriptLoadingService.POLICY_CROSS_ORIGIN", $AdfScriptLoadingService$$.$POLICY_CROSS_ORIGIN$);
  this.$POLICY_AUTO$ = "auto";
  $goog$exportSymbol$$("AdfScriptLoadingService.POLICY_AUTO", $AdfScriptLoadingService$$.$POLICY_AUTO$);
  this.$METHOD_ANY$ = 0;
  $goog$exportSymbol$$("AdfScriptLoadingService.METHOD_ANY", $AdfScriptLoadingService$$.$METHOD_ANY$);
  this.$METHOD_SYNCHRONOUS$ = 1;
  $goog$exportSymbol$$("AdfScriptLoadingService.METHOD_SYNCHRONOUS", $AdfScriptLoadingService$$.$METHOD_SYNCHRONOUS$);
  this.$METHOD_ASYNCHRONOUS$ = 2;
  $goog$exportSymbol$$("AdfScriptLoadingService.METHOD_ASYNCHRONOUS", $AdfScriptLoadingService$$.$METHOD_ASYNCHRONOUS$);
  this.$METHOD_BACKGROUND$ = 3;
  $goog$exportSymbol$$("AdfScriptLoadingService.METHOD_BACKGROUND", $AdfScriptLoadingService$$.$METHOD_BACKGROUND$);
  this.$STATUS_LOADING$ = 0;
  $goog$exportSymbol$$("AdfScriptLoadingService.STATUS_LOADING", $AdfScriptLoadingService$$.$STATUS_LOADING$);
  this.$STATUS_LOADED$ = 1;
  $goog$exportSymbol$$("AdfScriptLoadingService.STATUS_LOADED", $AdfScriptLoadingService$$.$STATUS_LOADED$);
};
$goog$exportSymbol$$("AdfScriptLoadingService.InitClass", $AdfScriptLoadingService$$.$InitClass$);
$AdfScriptLoadingService$$.prototype.Init = function $$AdfScriptLoadingService$$$$Init$($domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$, $domDocument$$79_scriptElements$$inline_5234$$, $i$$inline_5235_policy$$2$$) {
  $AdfScriptLoadingService$$.$superclass$.Init.call(this);
  $AdfAssert$$.assert(null == $i$$inline_5235_policy$$2$$ || $i$$inline_5235_policy$$2$$ == $AdfScriptLoadingService$$.$POLICY_SAME_ORIGIN$ || $i$$inline_5235_policy$$2$$ == $AdfScriptLoadingService$$.$POLICY_CROSS_ORIGIN$ || $i$$inline_5235_policy$$2$$ == $AdfScriptLoadingService$$.$POLICY_AUTO$);
  this.$_domWindow$ = $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$;
  this.$_domDocument$ = $domDocument$$79_scriptElements$$inline_5234$$;
  this.$_policy$ = $i$$inline_5235_policy$$2$$;
  this.$_loadableScripts$ = [];
  this.$_loadingScript$ = null;
  this.$_loading$ = !1;
  this.$_loadListeners$ = [];
  this.$_syncCallback$ = this.$createCallback$(this.$_syncLoadComplete$);
  this.$_asyncCallback$ = this.$createCallback$(this.$_asyncLoadComplete$);
  $AdfAssert$$.assert(null != this.$_domDocument$);
  $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$ = this.$_domDocument$.location.hostname;
  $AdfAssert$$.assert(null != $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$);
  this.$_sameOriginRegexp$ = new RegExp("^(http|https):([\\w-]+\\.)?" + $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$ + "[:/]", "i");
  if (!this.$_loadedLibraries$) {
    $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$ = {};
    $domDocument$$79_scriptElements$$inline_5234$$ = $domDocument$$79_scriptElements$$inline_5234$$.getElementsByTagName("script");
    for ($i$$inline_5235_policy$$2$$ = 0;$i$$inline_5235_policy$$2$$ < $domDocument$$79_scriptElements$$inline_5234$$.length;$i$$inline_5235_policy$$2$$++) {
      var $librarySource$$inline_5236$$ = $AdfScriptLoadingService$$.$_stripSessionId$($domDocument$$79_scriptElements$$inline_5234$$[$i$$inline_5235_policy$$2$$].getAttribute("src"));
      $librarySource$$inline_5236$$ && ($domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$[$librarySource$$inline_5236$$] = !0);
    }
    this.$_loadedLibraries$ = $domWindow$$135_hostname$$inline_5229_loadedLibraries$$inline_5233$$;
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.Init", {Init:$AdfScriptLoadingService$$.prototype.Init});
$AdfScriptLoadingService$$.prototype.$addLibraryScript$ = function $$AdfScriptLoadingService$$$$$addLibraryScript$$($librarySource$$2$$, $loadMethod$$2$$) {
  var $script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$ = $AdfScriptLoadingService$$.$_stripSessionId$($librarySource$$2$$);
  this.$_loadedLibraries$[$script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$] || ($script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$ = $AdfScriptLoadingService$$.$_stripSessionId$($librarySource$$2$$), this.$_loadedLibraries$[$script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$] = !0, $script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$ = this.$CreateLibraryLoadableScript$($librarySource$$2$$, 
  $loadMethod$$2$$), $JSCompiler_StaticMethods__addLoadableScript$$(this, $script$$6_strippedLibrarySource$$inline_5240_strippedLibrarySource$$inline_5244$$));
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.addLibraryScript", {$addLibraryScript$:$AdfScriptLoadingService$$.prototype.$addLibraryScript$});
$AdfScriptLoadingService$$.prototype.$addInlineScript$ = function $$AdfScriptLoadingService$$$$$addInlineScript$$($content$$35_loadableScript$$) {
  $content$$35_loadableScript$$ = new $AdfInlineLoadableScript$$(this.$_domWindow$, $content$$35_loadableScript$$);
  $JSCompiler_StaticMethods__addLoadableScript$$(this, $content$$35_loadableScript$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.addInlineScript", {$addInlineScript$:$AdfScriptLoadingService$$.prototype.$addInlineScript$});
$AdfScriptLoadingService$$.prototype.$addCallbackScript$ = function $$AdfScriptLoadingService$$$$$addCallbackScript$$($context$$84_loadableScript$$1$$, $callback$$130$$, $state$$102$$) {
  $context$$84_loadableScript$$1$$ = new $AdfCallbackLoadableScript$$($context$$84_loadableScript$$1$$, $callback$$130$$, $state$$102$$);
  $JSCompiler_StaticMethods__addLoadableScript$$(this, $context$$84_loadableScript$$1$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.addCallbackScript", {$addCallbackScript$:$AdfScriptLoadingService$$.prototype.$addCallbackScript$});
$AdfScriptLoadingService$$.prototype.$addLoadListener$ = function $$AdfScriptLoadingService$$$$$addLoadListener$$($listener$$120$$) {
  $AdfAssert$$.$assertFunction$($listener$$120$$);
  this.$_loadListeners$.push($listener$$120$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.addLoadListener", {$addLoadListener$:$AdfScriptLoadingService$$.prototype.$addLoadListener$});
$AdfScriptLoadingService$$.prototype.$removeLoadListener$ = function $$AdfScriptLoadingService$$$$$removeLoadListener$$($index$$228_listener$$121$$) {
  var $listeners$$21$$ = this.$_loadListeners$;
  $index$$228_listener$$121$$ = $listeners$$21$$.indexOf($index$$228_listener$$121$$);
  -1 < $index$$228_listener$$121$$ && $listeners$$21$$.splice($index$$228_listener$$121$$, 1);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.removeLoadListener", {$removeLoadListener$:$AdfScriptLoadingService$$.prototype.$removeLoadListener$});
$AdfScriptLoadingService$$.prototype.$CreateLibraryLoadableScript$ = function $$AdfScriptLoadingService$$$$$CreateLibraryLoadableScript$$($librarySource$$3$$, $loadMethod$$3$$) {
  var $loadableScript$$2$$ = null;
  return $loadableScript$$2$$ = this.$_policy$ == $AdfScriptLoadingService$$.$POLICY_SAME_ORIGIN$ || (this.$_policy$ == $AdfScriptLoadingService$$.$POLICY_CROSS_ORIGIN$ ? 0 : "/" == $librarySource$$3$$.charAt(0) || this.$_sameOriginRegexp$.test($librarySource$$3$$)) || $loadMethod$$3$$ == $AdfScriptLoadingService$$.$METHOD_SYNCHRONOUS$ ? new $AdfXmlHttpLibraryLoadableScript$$(this.$GetDomWindow$(), $librarySource$$3$$, $loadMethod$$3$$) : new $AdfDomLibraryLoadableScript$$(this.$GetDomWindow$(), 
  this.$GetDomDocument$(), $librarySource$$3$$, $loadMethod$$3$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.CreateLibraryLoadableScript", {$CreateLibraryLoadableScript$:$AdfScriptLoadingService$$.prototype.$CreateLibraryLoadableScript$});
$AdfScriptLoadingService$$.prototype.$GetDomWindow$ = function $$AdfScriptLoadingService$$$$$GetDomWindow$$() {
  return this.$_domWindow$;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.GetDomWindow", {$GetDomWindow$:$AdfScriptLoadingService$$.prototype.$GetDomWindow$});
$AdfScriptLoadingService$$.prototype.$GetDomDocument$ = function $$AdfScriptLoadingService$$$$$GetDomDocument$$() {
  return this.$_domDocument$;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfScriptLoadingService.prototype.GetDomDocument", {$GetDomDocument$:$AdfScriptLoadingService$$.prototype.$GetDomDocument$});
function $JSCompiler_StaticMethods__addLoadableScript$$($JSCompiler_StaticMethods__addLoadableScript$self$$, $loadableScript$$3$$) {
  var $numScripts$$ = $JSCompiler_StaticMethods__addLoadableScript$self$$.$_loadableScripts$.length;
  if (0 < $numScripts$$ && $loadableScript$$3$$.$getLoadMethod$() !== $AdfScriptLoadingService$$.$METHOD_BACKGROUND$) {
    for (var $added$$8$$ = !1, $i$$772$$ = 0;$i$$772$$ < $numScripts$$;++$i$$772$$) {
      if ($JSCompiler_StaticMethods__addLoadableScript$self$$.$_loadableScripts$[$i$$772$$].$getLoadMethod$() === $AdfScriptLoadingService$$.$METHOD_BACKGROUND$) {
        $JSCompiler_StaticMethods__addLoadableScript$self$$.$_loadableScripts$.splice($i$$772$$, 0, $loadableScript$$3$$);
        $added$$8$$ = !0;
        break;
      }
    }
    $added$$8$$ || $JSCompiler_StaticMethods__addLoadableScript$self$$.$_loadableScripts$.push($loadableScript$$3$$);
  } else {
    $JSCompiler_StaticMethods__addLoadableScript$self$$.$_loadableScripts$.push($loadableScript$$3$$);
  }
  $JSCompiler_StaticMethods__loadNextScript$$($JSCompiler_StaticMethods__addLoadableScript$self$$);
}
function $JSCompiler_StaticMethods__loadNextScript$$($JSCompiler_StaticMethods__loadNextScript$self$$) {
  if (!$JSCompiler_StaticMethods__loadNextScript$self$$.$_loadingScript$) {
    for (var $JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$ = $JSCompiler_StaticMethods__loadNextScript$self$$.$_loadableScripts$;0 < $JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$.length;) {
      var $loadableScript$$4$$ = $JSCompiler_StaticMethods__loadNextScript$self$$.$_loadingScript$ = $JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$.shift(), $loadMethod$$4$$ = $loadableScript$$4$$.$getLoadMethod$();
      if ($loadMethod$$4$$ === $AdfScriptLoadingService$$.$METHOD_SYNCHRONOUS$) {
        $loadableScript$$4$$.load($JSCompiler_StaticMethods__loadNextScript$self$$.$_syncCallback$);
      } else {
        $loadMethod$$4$$ === $AdfScriptLoadingService$$.$METHOD_BACKGROUND$ ? $JSCompiler_StaticMethods__notifyLoaded$$($JSCompiler_StaticMethods__loadNextScript$self$$) : ($JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$ = $JSCompiler_StaticMethods__loadNextScript$self$$, $JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$.$_loading$ || ($JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$.$_notify$($AdfScriptLoadingService$$.$STATUS_LOADING$), 
        $JSCompiler_StaticMethods__notifyLoading$self$$inline_5246_loadableScripts$$.$_loading$ = !0));
        $loadableScript$$4$$.load($JSCompiler_StaticMethods__loadNextScript$self$$.$_asyncCallback$);
        return;
      }
    }
    $JSCompiler_StaticMethods__notifyLoaded$$($JSCompiler_StaticMethods__loadNextScript$self$$);
  }
}
function $JSCompiler_StaticMethods__notifyLoaded$$($JSCompiler_StaticMethods__notifyLoaded$self$$) {
  $JSCompiler_StaticMethods__notifyLoaded$self$$.$_loading$ && ($JSCompiler_StaticMethods__notifyLoaded$self$$.$_loading$ = !1, $JSCompiler_StaticMethods__notifyLoaded$self$$.$_notify$($AdfScriptLoadingService$$.$STATUS_LOADED$));
}
$AdfScriptLoadingService$$.prototype.$_notify$ = function $$AdfScriptLoadingService$$$$$_notify$$($status$$10$$) {
  for (var $listeners$$22$$ = this.$_loadListeners$, $i$$773$$ = 0;$i$$773$$ < $listeners$$22$$.length;$i$$773$$++) {
    $listeners$$22$$[$i$$773$$]($status$$10$$);
  }
};
$AdfScriptLoadingService$$.prototype.$_syncLoadComplete$ = function $$AdfScriptLoadingService$$$$$_syncLoadComplete$$() {
  this.$_loadingScript$ = null;
};
$AdfScriptLoadingService$$.prototype.$_asyncLoadComplete$ = function $$AdfScriptLoadingService$$$$$_asyncLoadComplete$$() {
  this.$_syncLoadComplete$();
  $JSCompiler_StaticMethods__loadNextScript$$(this);
};
$AdfScriptLoadingService$$.$_stripSessionId$ = function $$AdfScriptLoadingService$$$$_stripSessionId$$($uri$$18$$) {
  return $uri$$18$$ ? $uri$$18$$.replace(/;[^\?]*/, "") : null;
};
