HiddenEye-Legacy/WebPages/iCloud/index_files/common-header.js.download
Usama Abdul Sattar 9da290eed0
iCloud added
2018-07-12 16:58:13 +05:00

2 lines
3.4 KiB
Plaintext

"use strict";!function(e){var t={URL:"/jslog",METHOD:"POST",EXCEPTION_PRETEXT:"APPLE ID : ",LOG_LEVEL:"ERROR",ALLOWED_LOG_LEVELS:["ERROR","DEBUG","OFF","INFO"],WARN_CAPTURE_CONSOLE_COLOR:"background: #FFF0F0; color: red",NAMESPACE_FOR_PM:"pmrpc.",POST_MESSAGE_LOG_STATUS:"ON"},n=t.URL,o=t.LOG_LEVEL,i=t.NAMESPACE_FOR_PM,r="",s="",a=t.POST_MESSAGE_LOG_STATUS,p=function(e){this.name="IllegalLogException",this.message=t.EXCEPTION_PRETEXT+e,this.stack=(new Error).stack},g=function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)try{window.sessionStorage&&sessionStorage.setItem(e,t)}catch(n){}},c=function(e){var t=" type, title, message are mandatory. ";if("undefined"==typeof e)throw new p("logObject is not defined.");if("undefined"==typeof e.type)throw new p("logObject.type is not defined."+t);if("undefined"==typeof e.title)throw new p("logObject.title is not defined."+t);if("undefined"==typeof e.message)throw new p("logObject.message is not defined."+t);return!0},E=function(e){if(!e)throw new p("Invalid endpoint URL: "+e);return!0},f=function(e){E(e)&&(n=e)},d=function(){return n},O=function(e){e&&"string"==typeof e&&e.toUpperCase().trim()&&-1!==t.ALLOWED_LOG_LEVELS.indexOf(e.toUpperCase().trim())&&(o=e.toUpperCase().trim())},l=function(e){return o},L=function(e){if(!e||"NULL"===e.toString().toUpperCase().trim()||"UNDEFINED"===e.toString().toUpperCase().trim())throw new p("SCNT token is not valid.");r=e},u=function(e){if(!e||"NULL"===e.toString().toUpperCase().trim()||"UNDEFINED"===e.toString().toUpperCase().trim())throw new p("CSRF token is not valid.");s=e},S=function(e,i){if(c(e)){var a=function(){g(t.EXCEPTION_PRETEXT,"Logging transaction failed or cancelled at."+n)};e.message=t.EXCEPTION_PRETEXT+e.message,e.details&&(e.details=JSON.stringify(e.details)),i&&L(i);try{var p=new XMLHttpRequest;p.open(t.METHOD,n,!0),p.setRequestHeader("Content-type","application/json"),p.setRequestHeader("Accept","application/json"),p.setRequestHeader("scnt",r),p.setRequestHeader("x-csrf-token",s),p.addEventListener("error",a),p.addEventListener("abort",a),p.onreadystatechange=function(){204!==p.status},"OFF"!==o&&("INFO"===o||"ERROR"===o?("ERROR"===e.type.toUpperCase().trim()||"INFO"===e.type.toUpperCase().trim())&&p.send(JSON.stringify(e)):"DEBUG"===o&&p.send(JSON.stringify(e)))}catch(E){}}},R=function(e){setTimeout(function(){throw e},0)},m=function(){return i},N=function(e){"string"==typeof e&&e.trim()&&(i=e)},y=function(){return a},T=function(e){a="string"==typeof e&&e.trim()&&-1!==["ON","OFF"].indexOf(e.toUpperCase().trim())?e.toUpperCase().trim():t.POST_MESSAGE_LOG_STATUS},w={log:S,onerror:R,getLoggingEndpoint:d,setLoggingEndpoint:f,setGlobalLogLevel:O,getGlobalLogLevel:l,setSCNT:L,setCSRF:u,getNamespaceForPM:m,setNamespaceForPM:N,getPMLoggingStatus:y,setPMLoggingStatus:T};p.prototype=Object.create(Error.prototype),p.prototype.constructor=p,e.AppleID=e.AppleID||{},e.AppleID.service=e.AppleID.service||{},e.AppleID.service.JSLogger=e.AppleID.service.JSLogger||w,window.onerror=function(n,o,r,s,p){if("ON"===a){var g=parseInt(1e16*Math.random()).toString(),c={jsonrpc:"2.0",method:"log",params:[{data:"AppleAuth failed to load."}],id:g};window.parent.postMessage(i+JSON.stringify(c),"*")}e.AppleID.service.JSLogger.log({title:p&&(p.name||"ERROR"),type:t.LOG_LEVEL,message:n,stacktrace:p&&(p.stack||JSON.stringify(p)),details:{file:o,lineno:r,colno:s,caught:"NO"}})}}(window),function(){try{window.AppleID.service.JSLogger.setLoggingEndpoint("/appleauth/jslog")}catch(e){}}();