function AdfSafariAgent(version, domWindow) {
  this.Init(version, domWindow)
}
AdfObject.createSubclass(AdfSafariAgent, AdfAgent);
AdfSafariAgent.prototype.Init = function(version, domWindow) {
  AdfSafariAgent.superclass.Init.call(this, AdfAgent.WEBKIT_PLATFORM, AdfAgent.guessOS(), version, domWindow)
};
AdfSafariAgent.prototype.getWindowScrollWidth = function(domWindow) {
  var theDocument = domWindow.document;
  var sizeTarget = theDocument.body;
  return sizeTarget.scrollWidth
};
AdfSafariAgent.prototype.getWindowScrollHeight = function(domWindow) {
  var theDocument = domWindow.document;
  var sizeTarget = theDocument.body;
  return sizeTarget.scrollHeight
};
AdfSafariAgent.prototype.getBrowserViewportScrollTop = function() {
  var agentName = navigator.userAgent;
  var domDoc = this.getDomDocument();
  if(agentName.indexOf("Chrome") != -1 && AdfSafariAgent.__getAgentVersion(agentName) >= 61) {
    return domDoc.documentElement.scrollTop
  }else {
    if(agentName.indexOf("Safari") != -1 && AdfSafariAgent.__getAgentVersion(agentName) >= 13) {
      var domWindow = this.getDomWindow();
      return domWindow.pageYOffset
    }else {
      return domDoc.body.scrollTop
    }
  }
};
AdfSafariAgent.prototype.getBrowserViewportScrollLeft = function() {
  var agentName = navigator.userAgent;
  var domDoc = this.getDomDocument();
  if(agentName.indexOf("Chrome") != -1 && AdfSafariAgent.__getAgentVersion(agentName) >= 61) {
    return domDoc.documentElement.scrollLeft
  }else {
    if(agentName.indexOf("Safari") != -1 && AdfSafariAgent.__getAgentVersion(agentName) >= 13) {
      var domWindow = this.getDomWindow();
      return domWindow.pageXOffset
    }else {
      return domDoc.body.scrollLeft
    }
  }
};
AdfSafariAgent.prototype.InitClass = function() {
  var modifierDisplayStrings = new Array;
  modifierDisplayStrings[AdfKeyStroke.CTRL_MASK] = "Ctrl";
  modifierDisplayStrings[AdfKeyStroke.SHIFT_MASK] = "Shift";
  modifierDisplayStrings[AdfKeyStroke.ALT_MASK] = "Option";
  modifierDisplayStrings[AdfKeyStroke.META_MASK] = "Cmd";
  this._MODIFIER_DISPLAY_NAMES = modifierDisplayStrings
};
AdfSafariAgent.prototype.CreateDefaultLogWriter = function(nativeLogWriter) {
  return nativeLogWriter
};
AdfSafariAgent.prototype.CreateNativeLogWriter = function() {
  var domWindow = this.getDomWindow();
  return domWindow.console ? new AdfSafariLogWriter(domWindow, new AdfAlertLogWriter) : new AdfAlertLogWriter
};
AdfSafariAgent.prototype.execScript = function(ownerWindow, scriptText) {
  var document = ownerWindow.document;
  var scriptParent = document.body;
  if(scriptParent == null) {
    with(ownerWindow) {
      ownerWindow.eval(scriptText)
    }
    return
  }
  var scriptElem = document.createElement("script");
  scriptElem.setAttribute("type", "text/javascript");
  scriptElem.appendChild(document.createTextNode(scriptText));
  scriptParent.appendChild(scriptElem);
  scriptParent.removeChild(scriptElem)
};
AdfSafariAgent.prototype.disableUserSelect = function(element) {
  element.style.setProperty("-webkit-user-select", "none")
};
AdfSafariAgent.prototype.enableUserSelect = function(element) {
  element.style.setProperty("-webkit-user-select", "")
};
AdfSafariAgent.prototype.getBoxSizing = function(element, currentStyle) {
  if(!currentStyle) {
    currentStyle = this.getComputedStyle(element)
  }
  return currentStyle.getPropertyValue("-webkit-box-sizing")
};
AdfSafariAgent.prototype.getModifierDisplayName = function(modifier) {
  if(this.getOs() != AdfAgent.MAC_OS) {
    return AdfSafariAgent.superclass.getModifierDisplayName.call(this, modifier)
  }
  return AdfSafariAgent._MODIFIER_DISPLAY_NAMES[modifier]
};
AdfSafariAgent.prototype.isSessionStorageEnabled = function() {
  if(this._isSessionStorageEnabled === undefined) {
    try {
      sessionStorage.setItem("_adfTestKey", "on");
      sessionStorage.removeItem("_adfTestKey");
      this._isSessionStorageEnabled = true
    }catch(e) {
      if(e.name === "QUOTA_EXCEEDED_ERR" && e.code == 22) {
        AdfLogger.LOGGER.fine("Access to sessionStorage has been disabled because 'private browsing' " + "is enabled. As a result user activity monitoring has been disabled. Name: " + e.name + ", Message: " + e.message)
      }else {
        AdfLogger.LOGGER.fine("Access to sessionStorage failed for some unexpected reason. As " + "a result user activity monitoring has been disabled. Name: " + e.name + ", Message: " + e.message)
      }
      this._isSessionStorageEnabled = false
    }
  }
  return this._isSessionStorageEnabled
};
AdfSafariAgent.prototype.CreateUIInputEvent = function(component, type, nativeEvent) {
  return new AdfSafariUIInputEvent(component, type, nativeEvent)
};
AdfSafariAgent.prototype.cloneEvent = function(event, newTarget) {
  var eventType = event.type;
  if(eventType == "load") {
    var agentName = navigator.userAgent.toLowerCase();
    if(agentName.indexOf("chrome") == -1) {
      return AdfSafariAgent.superclass.cloneEvent.call(this, event, newTarget)
    }
    var targetNode = newTarget ? newTarget : event.target;
    var targetDocument = targetNode.ownerDocument;
    var newEvent = targetDocument.createEvent("Event");
    newEvent.initEvent("click", false, false);
    targetDocument.addEventListener(eventType, this.stopPropagation, true);
    targetNode.dispatchEvent(newEvent);
    targetDocument.removeEventListener(eventType, this.stopPropagation, true);
    return newEvent
  }else {
    return AdfSafariAgent.superclass.cloneEvent.call(this, event, newTarget)
  }
};
AdfSafariAgent.prototype.slice = function(file, startByte, stopByte) {
  if(typeof Blob === "undefined" || typeof Blob.prototype.slice === "undefined" && typeof Blob.prototype.webkitSlice === "undefined") {
    return undefined
  }
  if(file == null) {
    return null
  }
  if(file.slice) {
    return file.slice(startByte, stopByte)
  }else {
    if(file.webkitSlice) {
      return file.webkitSlice(startByte, stopByte)
    }
  }
  return undefined
};
AdfSafariAgent.__getAgentVersion = function(userAgent) {
  var version;
  if(userAgent.indexOf("Chrome/") != -1) {
    version = AdfAgent.__parseFloatVersion(userAgent, /Chrome\/(\d+([.]\d+)*)/)
  }else {
    if(userAgent.indexOf("Version/") != -1) {
      version = AdfAgent.__parseFloatVersion(userAgent, /Version\/(\d+([.]\d+)*)/)
    }
  }
  return version
};
AdfSafariAgent.__getSupported = function(userAgent, version) {
  var supported = true;
  if(userAgent.indexOf("Chrome/") != -1) {
    if(version < AdfAgent._MIN_CHROME_VERSION) {
      supported = false
    }
  }else {
    if(userAgent.indexOf("Version/") != -1) {
      if(version < AdfAgent._MIN_SAFARI_VERSION) {
        supported = false
      }
    }
  }
  return supported
};
AdfSafariAgent.__getSpecificAgentClassName = function(userAgent, version) {
  if(userAgent.indexOf("Mobile") == -1 && userAgent.indexOf("Android") == -1 && userAgent.indexOf("iPhone") == -1) {
    return"AdfSafariAgent"
  }else {
    return"AdfSafariMobileAgent"
  }
};
AdfSafariAgent.prototype.createTouchMoveManager = function(element, handlerCallback, touchCount) {
  return new AdfSafariTouchMoveManager(element, handlerCallback, touchCount)
};
