/* Agave error ux page javascript */

/*
	Copyright (c) Microsoft Corporation.  All rights reserved.
*/


/*
    Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.

    This file also contains the following Promise implementation (with a few small modifications):
        * @overview es6-promise - a tiny implementation of Promises/A+.
        * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
        * @license   Licensed under MIT license
        *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
        * @version   2.3.0
*/
var OfficeExt;(function(b){var a=function(){var a=true;function b(){}b.prototype.isMsAjaxLoaded=function(){var b="function",c="undefined";if(typeof Sys!==c&&typeof Type!==c&&Sys.StringBuilder&&typeof Sys.StringBuilder===b&&Type.registerNamespace&&typeof Type.registerNamespace===b&&Type.registerClass&&typeof Type.registerClass===b&&typeof Function._validateParams===b&&Sys.Serialization&&Sys.Serialization.JavaScriptSerializer&&typeof Sys.Serialization.JavaScriptSerializer.serialize===b)return a;else return false};b.prototype.loadMsAjaxFull=function(b){var a=(window.location.protocol.toLowerCase()==="https:"?"https:":"http:")+"//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js";OSF.OUtil.loadScript(a,b)};Object.defineProperty(b.prototype,"msAjaxError",{"get":function(){var a=this;if(a._msAjaxError==null&&a.isMsAjaxLoaded())a._msAjaxError=Error;return a._msAjaxError},"set":function(a){this._msAjaxError=a},enumerable:a,configurable:a});Object.defineProperty(b.prototype,"msAjaxString",{"get":function(){var a=this;if(a._msAjaxString==null&&a.isMsAjaxLoaded())a._msAjaxString=String;return a._msAjaxString},"set":function(a){this._msAjaxString=a},enumerable:a,configurable:a});Object.defineProperty(b.prototype,"msAjaxDebug",{"get":function(){var a=this;if(a._msAjaxDebug==null&&a.isMsAjaxLoaded())a._msAjaxDebug=Sys.Debug;return a._msAjaxDebug},"set":function(a){this._msAjaxDebug=a},enumerable:a,configurable:a});return b}();b.MicrosoftAjaxFactory=a})(OfficeExt||(OfficeExt={}));var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory,OSF=OSF||{};(function(b){var a=function(){function a(a){this._internalStorage=a}a.prototype.getItem=function(a){try{return this._internalStorage&&this._internalStorage.getItem(a)}catch(b){return null}};a.prototype.setItem=function(b,a){try{this._internalStorage&&this._internalStorage.setItem(b,a)}catch(c){}};a.prototype.clear=function(){try{this._internalStorage&&this._internalStorage.clear()}catch(a){}};a.prototype.removeItem=function(a){try{this._internalStorage&&this._internalStorage.removeItem(a)}catch(b){}};a.prototype.getKeysWithPrefix=function(d){var b=[];try{for(var e=this._internalStorage&&this._internalStorage.length||0,a=0;a<e;a++){var c=this._internalStorage.key(a);c.indexOf(d)===0&&b.push(c)}}catch(f){}return b};a.prototype.isLocalStorageAvailable=function(){return this._internalStorage!=null};return a}();b.SafeStorage=a})(OfficeExt||(OfficeExt={}));OSF.XdmFieldName={ConversationUrl:"ConversationUrl",AppId:"AppId"};OSF.TestFlightStart=1e3;OSF.TestFlightEnd=1009;OSF.FlightNames={UseOriginNotUrl:0,AddinEnforceHttps:2,FirstPartyAnonymousProxyReadyCheckTimeout:6,AddinRibbonIdAllowUnknown:9,ManifestParserDevConsoleLog:15,AddinActionDefinitionHybridMode:18,UseActionIdForUILessCommand:20,RequirementSetRibbonApiOnePointTwo:21,SetFocusToTaskpaneIsEnabled:22,ShortcutInfoArrayInUserPreferenceData:23,OSFTestFlight1000:OSF.TestFlightStart,OSFTestFlight1001:OSF.TestFlightStart+1,OSFTestFlight1002:OSF.TestFlightStart+2,OSFTestFlight1003:OSF.TestFlightStart+3,OSFTestFlight1004:OSF.TestFlightStart+4,OSFTestFlight1005:OSF.TestFlightStart+5,OSFTestFlight1006:OSF.TestFlightStart+6,OSFTestFlight1007:OSF.TestFlightStart+7,OSFTestFlight1008:OSF.TestFlightStart+8,OSFTestFlight1009:OSF.TestFlightEnd};OSF.TrustUXFlightValues={TrustUXControlA:0,TrustUXExperimentB:1,TrustUXExperimentC:2};OSF.FlightTreatmentNames={AddinDialogIFrameContentWindowKillSwitch:"Microsoft.Office.SharedOnline.AddinDialogIFrameContentWindowKillSwitch",AddinTrustUXImprovement:"Microsoft.Office.SharedOnline.AddinTrustUXImprovement",AllowStorageAccessByUserActivationOnIFrameCheck:"Microsoft.Office.SharedOnline.AllowStorageAccessByUserActivationOnIFrameCheck",BlockAutoOpenAddInIfStoreDisabled:"Microsoft.Office.SharedOnline.BlockAutoOpenAddInIfStoreDisabled",CheckProxyIsReadyRetry:"Microsoft.Office.SharedOnline.OEP.CheckProxyIsReadyRetry",InsertionDialogFixesEnabled:"Microsoft.Office.SharedOnline.InsertionDialogFixesEnabled",TeachingUIForPrivateCatelogEnabled:"Microsoft.Office.SharedOnline.TeachingUIForPrivateCatelogEnabled",WopiPreinstalledAddInsEnabled:"Microsoft.Office.SharedOnline.WopiPreinstalledAddInsEnabled",WopiUseNewActivate:"Microsoft.Office.SharedOnline.WopiUseNewActivate",MosManifestEnabled:"Microsoft.Office.SharedOnline.OEP.MosManifest"};OSF.Flights=[];OSF.IntFlights={};OSF.Settings={};OSF.WindowNameItemKeys={BaseFrameName:"baseFrameName",HostInfo:"hostInfo",XdmInfo:"xdmInfo",SerializerVersion:"serializerVersion",AppContext:"appContext",Flights:"flights"};OSF.OUtil=function(){var l="focus",k="https:",j="on",q="configurable",p="writable",i="enumerable",e="",f="undefined",c=false,b=true,h="string",m=2147483647,a=null,g="#",d=-1,w=d,C="&_xdm_Info=",z="&_serializer_version=",B="&_flights=",A="_xdm_",F="_serializer_version=",G="_flights=",s=g,y="&",n="class",v={},E=3e4,r=a,u=a,o=(new Date).getTime();function D(){var a=m*Math.random();a^=o^(new Date).getMilliseconds()<<Math.floor(Math.random()*(31-10));return a.toString(16)}function t(){if(!r){try{var b=window.sessionStorage}catch(c){b=a}r=new OfficeExt.SafeStorage(b)}return r}function x(e){for(var c=[],b=[],f=e.length,a,d=0;d<f;d++){a=e[d];if(a.tabIndex)if(a.tabIndex>0)b.push(a);else a.tabIndex===0&&c.push(a);else c.push(a)}b=b.sort(function(d,c){var a=d.tabIndex-c.tabIndex;if(a===0)a=b.indexOf(d)-b.indexOf(c);return a});return [].concat(b,c)}return {set_entropy:function(a){if(typeof a==h)for(var b=0;b<a.length;b+=4){for(var d=0,c=0;c<4&&b+c<a.length;c++)d=(d<<8)+a.charCodeAt(b+c);o^=d}else if(typeof a=="number")o^=a;else o^=m*Math.random();o&=m},extend:function(b,a){var c=function(){};c.prototype=a.prototype;b.prototype=new c;b.prototype.constructor=b;b.uber=a.prototype;if(a.prototype.constructor===Object.prototype.constructor)a.prototype.constructor=a},setNamespace:function(b,a){if(a&&b&&!a[b])a[b]={}},unsetNamespace:function(b,a){if(a&&b&&a[b])delete a[b]},serializeSettings:function(b){var d={};for(var c in b){var a=b[c];try{if(JSON)a=JSON.stringify(a,function(a,b){return OSF.OUtil.isDate(this[a])?OSF.DDA.SettingsManager.DateJSONPrefix+this[a].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix:b});else a=Sys.Serialization.JavaScriptSerializer.serialize(a);d[c]=a}catch(e){}}return d},deserializeSettings:function(c){var f={};c=c||{};for(var e in c){var a=c[e];try{if(JSON)a=JSON.parse(a,function(c,a){var b;if(typeof a===h&&a&&a.length>6&&a.slice(0,5)===OSF.DDA.SettingsManager.DateJSONPrefix&&a.slice(d)===OSF.DDA.SettingsManager.DataJSONSuffix){b=new Date(parseInt(a.slice(5,d)));if(b)return b}return a});else a=Sys.Serialization.JavaScriptSerializer.deserialize(a,b);f[e]=a}catch(g){}}return f},loadScript:function(f,g,i){if(f&&g){var k=window.document,d=v[f];if(!d){var e=k.createElement("script");e.type="text/javascript";d={loaded:c,pendingCallbacks:[g],timer:a};v[f]=d;var j=function(){if(d.timer!=a){clearTimeout(d.timer);delete d.timer}d.loaded=b;for(var e=d.pendingCallbacks.length,c=0;c<e;c++){var f=d.pendingCallbacks.shift();f()}},l=function(){if(window.navigator.userAgent.indexOf("Trident")>0)h(a);else h(new Event("Script load timed out"))},h=function(g){delete v[f];if(d.timer!=a){clearTimeout(d.timer);delete d.timer}for(var c=d.pendingCallbacks.length,b=0;b<c;b++){var e=d.pendingCallbacks.shift();e(g)}};if(e.readyState)e.onreadystatechange=function(){if(e.readyState=="loaded"||e.readyState=="complete"){e.onreadystatechange=a;j()}};else e.onload=j;e.onerror=h;i=i||E;d.timer=setTimeout(l,i);e.setAttribute("crossOrigin","anonymous");e.src=f;k.getElementsByTagName("head")[0].appendChild(e)}else if(d.loaded)g();else d.pendingCallbacks.push(g)}},loadCSS:function(c){if(c){var b=window.document,a=b.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=c;b.getElementsByTagName("head")[0].appendChild(a)}},parseEnum:function(b,c){var a=c[b.trim()];if(typeof a==f){OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+b);throw OsfMsAjaxFactory.msAjaxError.argument("str")}return a},delayExecutionAndCache:function(){var a={calc:arguments[0]};return function(){if(a.calc){a.val=a.calc.apply(this,arguments);delete a.calc}return a.val}},getUniqueId:function(){w=w+1;return w.toString()},formatString:function(){var a=arguments,b=a[0];return b.replace(/{(\d+)}/gm,function(d,b){var c=parseInt(b,10)+1;return a[c]===undefined?"{"+b+"}":a[c]})},generateConversationId:function(){return [D(),D(),(new Date).getTime().toString()].join("_")},getFrameName:function(a){return A+a+this.generateConversationId()},addXdmInfoAsHash:function(b,a){return OSF.OUtil.addInfoAsHash(b,C,a,c)},addSerializerVersionAsHash:function(c,a){return OSF.OUtil.addInfoAsHash(c,z,a,b)},addFlightsAsHash:function(c,a){return OSF.OUtil.addInfoAsHash(c,B,a,b)},addInfoAsHash:function(b,g,c,i){b=b.trim()||e;var f=b.split(s),h=f.shift(),d=f.join(s),a;if(i)a=[g,encodeURIComponent(c),d].join(e);else a=[d,g,c].join(e);return [h,s,a].join(e)},parseHostInfoFromWindowName:function(a,b){return OSF.OUtil.parseInfoFromWindowName(a,b,OSF.WindowNameItemKeys.HostInfo)},parseXdmInfo:function(b){var a=OSF.OUtil.parseXdmInfoWithGivenFragment(b,window.location.hash);if(!a)a=OSF.OUtil.parseXdmInfoFromWindowName(b,window.name);return a},parseXdmInfoFromWindowName:function(a,b){return OSF.OUtil.parseInfoFromWindowName(a,b,OSF.WindowNameItemKeys.XdmInfo)},parseXdmInfoWithGivenFragment:function(a,b){return OSF.OUtil.parseInfoWithGivenFragment(C,A,c,a,b)},parseSerializerVersion:function(b){var a=OSF.OUtil.parseSerializerVersionWithGivenFragment(b,window.location.hash);if(isNaN(a))a=OSF.OUtil.parseSerializerVersionFromWindowName(b,window.name);return a},parseSerializerVersionFromWindowName:function(a,b){return parseInt(OSF.OUtil.parseInfoFromWindowName(a,b,OSF.WindowNameItemKeys.SerializerVersion))},parseSerializerVersionWithGivenFragment:function(a,c){return parseInt(OSF.OUtil.parseInfoWithGivenFragment(z,F,b,a,c))},parseFlights:function(b){var a=OSF.OUtil.parseFlightsWithGivenFragment(b,window.location.hash);if(a.length==0)a=OSF.OUtil.parseFlightsFromWindowName(b,window.name);return a},checkFlight:function(a){return OSF.Flights&&OSF.Flights.indexOf(a)>=0},pushFlight:function(a){if(OSF.Flights.indexOf(a)<0){OSF.Flights.push(a);return b}return c},getBooleanSetting:function(a){return OSF.OUtil.getBooleanFromDictionary(OSF.Settings,a)},getBooleanFromDictionary:function(b,a){var d=b&&a&&b[a]!==undefined&&b[a]&&(typeof b[a]===h&&b[a].toUpperCase()==="TRUE"||typeof b[a]==="boolean"&&b[a]);return d!==undefined?d:c},getIntFromDictionary:function(b,a){if(b&&a&&b[a]!==undefined&&typeof b[a]===h)return parseInt(b[a]);else return NaN},pushIntFlight:function(a,d){if(!(a in OSF.IntFlights)){OSF.IntFlights[a]=d;return b}return c},getIntFlight:function(a){if(OSF.IntFlights&&a in OSF.IntFlights)return OSF.IntFlights[a];else return NaN},parseFlightsFromWindowName:function(a,b){return OSF.OUtil.parseArrayWithDefault(OSF.OUtil.parseInfoFromWindowName(a,b,OSF.WindowNameItemKeys.Flights))},parseFlightsWithGivenFragment:function(a,c){return OSF.OUtil.parseArrayWithDefault(OSF.OUtil.parseInfoWithGivenFragment(B,G,b,a,c))},parseArrayWithDefault:function(b){var a=[];try{a=JSON.parse(b)}catch(c){}if(!Array.isArray(a))a=[];return a},parseInfoFromWindowName:function(g,h,f){try{var b=JSON.parse(h),c=b!=a?b[f]:a,d=t();if(!g&&d&&b!=a){var e=b[OSF.WindowNameItemKeys.BaseFrameName]+f;if(c)d.setItem(e,c);else c=d.getItem(e)}return c}catch(i){return a}},parseInfoWithGivenFragment:function(m,j,k,i,l){var f=l.split(m),b=f.length>1?f[f.length-1]:a;if(k&&b!=a){if(b.indexOf(y)>=0)b=b.split(y)[0];b=decodeURIComponent(b)}var c=t();if(!i&&c){var e=window.name.indexOf(j);if(e>d){var g=window.name.indexOf(";",e);if(g==d)g=window.name.length;var h=window.name.substring(e,g);if(b)c.setItem(h,b);else b=c.getItem(h)}}return b},getConversationId:function(){var c=window.location.search,b=a;if(c){var d=c.indexOf("&");b=d>0?c.substring(1,d):c.substr(1);if(b&&b.charAt(b.length-1)==="="){b=b.substring(0,b.length-1);if(b)b=decodeURIComponent(b)}}return b},getInfoItems:function(b){var a=b.split("$");if(typeof a[1]==f)a=b.split("|");if(typeof a[1]==f)a=b.split("%7C");return a},getXdmFieldValue:function(f,d){var b=e,c=OSF.OUtil.parseXdmInfo(d);if(c){var a=OSF.OUtil.getInfoItems(c);if(a!=undefined&&a.length>=3)switch(f){case OSF.XdmFieldName.ConversationUrl:b=a[2];break;case OSF.XdmFieldName.AppId:b=a[1]}}return b},validateParamObject:function(f,e){var a=Function._validateParams(arguments,[{name:"params",type:Object,mayBeNull:c},{name:"expectedProperties",type:Object,mayBeNull:c},{name:"callback",type:Function,mayBeNull:b}]);if(a)throw a;for(var d in e){a=Function._validateParameter(f[d],e[d],d);if(a)throw a}},writeProfilerMark:function(a){if(window.msWriteProfilerMark){window.msWriteProfilerMark(a);OsfMsAjaxFactory.msAjaxDebug.trace(a)}},outputDebug:function(a){typeof OsfMsAjaxFactory!==f&&OsfMsAjaxFactory.msAjaxDebug&&OsfMsAjaxFactory.msAjaxDebug.trace&&OsfMsAjaxFactory.msAjaxDebug.trace(a)},defineNondefaultProperty:function(e,f,a,c){a=a||{};for(var g in c){var d=c[g];if(a[d]==undefined)a[d]=b}Object.defineProperty(e,f,a);return e},defineNondefaultProperties:function(c,a,d){a=a||{};for(var b in a)OSF.OUtil.defineNondefaultProperty(c,b,a[b],d);return c},defineEnumerableProperty:function(c,b,a){return OSF.OUtil.defineNondefaultProperty(c,b,a,[i])},defineEnumerableProperties:function(b,a){return OSF.OUtil.defineNondefaultProperties(b,a,[i])},defineMutableProperty:function(c,b,a){return OSF.OUtil.defineNondefaultProperty(c,b,a,[p,i,q])},defineMutableProperties:function(b,a){return OSF.OUtil.defineNondefaultProperties(b,a,[p,i,q])},finalizeProperties:function(e,d){d=d||{};for(var g=Object.getOwnPropertyNames(e),i=g.length,f=0;f<i;f++){var h=g[f],a=Object.getOwnPropertyDescriptor(e,h);if(!a.get&&!a.set)a.writable=d.writable||c;a.configurable=d.configurable||c;a.enumerable=d.enumerable||b;Object.defineProperty(e,h,a)}return e},mapList:function(a,c){var b=[];if(a)for(var d in a)b.push(c(a[d]));return b},listContainsKey:function(d,e){for(var a in d)if(e==a)return b;return c},listContainsValue:function(a,d){for(var e in a)if(d==a[e])return b;return c},augmentList:function(a,b){var d=a.push?function(c,b){a.push(b)}:function(c,b){a[c]=b};for(var c in b)d(c,b[c])},redefineList:function(a,b){for(var d in a)delete a[d];for(var c in b)a[c]=b[c]},isArray:function(a){return Object.prototype.toString.apply(a)==="[object Array]"},isFunction:function(a){return Object.prototype.toString.apply(a)==="[object Function]"},isDate:function(a){return Object.prototype.toString.apply(a)==="[object Date]"},addEventListener:function(a,b,d){if(a.addEventListener)a.addEventListener(b,d,c);else if(Sys.Browser.agent===Sys.Browser.InternetExplorer&&a.attachEvent)a.attachEvent(j+b,d);else a[j+b]=d},removeEventListener:function(b,d,e){if(b.removeEventListener)b.removeEventListener(d,e,c);else if(Sys.Browser.agent===Sys.Browser.InternetExplorer&&b.detachEvent)b.detachEvent(j+d,e);else b[j+d]=a},xhrGet:function(f,e,c){var a;try{a=new XMLHttpRequest;a.onreadystatechange=function(){if(a.readyState==4)if(a.status==200)e(a.responseText);else c(a.status)};a.open("GET",f,b);a.send()}catch(d){c(d)}},encodeBase64:function(c){if(!c)return c;var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=[],b=[],i=0,k,h,j,d,f,g,a,n=c.length;do{k=c.charCodeAt(i++);h=c.charCodeAt(i++);j=c.charCodeAt(i++);a=0;d=k&255;f=k>>8;g=h&255;b[a++]=d>>2;b[a++]=(d&3)<<4|f>>4;b[a++]=(f&15)<<2|g>>6;b[a++]=g&63;if(!isNaN(h)){d=h>>8;f=j&255;g=j>>8;b[a++]=d>>2;b[a++]=(d&3)<<4|f>>4;b[a++]=(f&15)<<2|g>>6;b[a++]=g&63}if(isNaN(h))b[a-1]=64;else if(isNaN(j)){b[a-2]=64;b[a-1]=64}for(var l=0;l<a;l++)m.push(o.charAt(b[l]))}while(i<n);return m.join(e)},getSessionStorage:function(){return t()},getLocalStorage:function(){if(!u){try{var b=window.localStorage}catch(c){b=a}u=new OfficeExt.SafeStorage(b)}return u},convertIntToCssHexColor:function(b){var a=g+(Number(b)+16777216).toString(16).slice(-6);return a},attachClickHandler:function(a,b){a.onclick=function(){b()};a.ontouchend=function(a){b();a.preventDefault()}},getQueryStringParamValue:function(a,d){var f=Function._validateParams(arguments,[{name:"queryString",type:String,mayBeNull:c},{name:"paramName",type:String,mayBeNull:c}]);if(f){OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");return e}var b=new RegExp("[\\?&]"+d+"=([^&#]*)","i");if(!b.test(a)){OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");return e}return b.exec(a)[1]},getHostnamePortionForLogging:function(d){var f=Function._validateParams(arguments,[{name:"hostname",type:String,mayBeNull:c}]);if(f)return e;var a=d.split("."),b=a.length;if(b>=2)return a[b-2]+"."+a[b-1];else if(b==1)return a[0]},isiOS:function(){return window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?b:c},isChrome:function(){return window.navigator.userAgent.indexOf("Chrome")>0&&!OSF.OUtil.isEdge()},isEdge:function(){return window.navigator.userAgent.indexOf("Edge")>0},isIE:function(){return window.navigator.userAgent.indexOf("Trident")>0},isFirefox:function(){return window.navigator.userAgent.indexOf("Firefox")>0},startsWith:function(b,a,c){if(c)return b.substr(0,a.length)===a;else return b.startsWith(a)},containsPort:function(d,e,c,a){return this.startsWith(d,e+"//"+c+":"+a,b)||this.startsWith(d,c+":"+a,b)},getRedundandPortString:function(b,a){if(!b||!a)return e;if(a.protocol==k&&this.containsPort(b,k,a.hostname,"443"))return ":443";else if(a.protocol=="http:"&&this.containsPort(b,"http:",a.hostname,"80"))return ":80";return e},removeChar:function(a,b){if(b<a.length-1)return a.substring(0,b)+a.substring(b+1);else if(b==a.length-1)return a.substring(0,a.length-1);else return a},cleanUrlOfChar:function(a,c){for(var b=0;b<a.length;b++)if(a.charAt(b)===c)if(b+1>=a.length)return this.removeChar(a,b);else if(c==="/"){if(a.charAt(b+1)==="?"||a.charAt(b+1)===g)return this.removeChar(a,b)}else if(c==="?")if(a.charAt(b+1)===g)return this.removeChar(a,b);return a},cleanUrl:function(a){a=this.cleanUrlOfChar(a,"/");a=this.cleanUrlOfChar(a,"?");a=this.cleanUrlOfChar(a,g);if(a.substr(0,8)=="https://"){var b=a.indexOf(":443");if(b!=d)if(b==a.length-4||a.charAt(b+4)=="/"||a.charAt(b+4)=="?"||a.charAt(b+4)==g)a=a.substring(0,b)+a.substring(b+4)}else if(a.substr(0,7)=="http://"){var b=a.indexOf(":80");if(b!=d)if(b==a.length-3||a.charAt(b+3)=="/"||a.charAt(b+3)=="?"||a.charAt(b+3)==g)a=a.substring(0,b)+a.substring(b+3)}return a},parseUrl:function(g,i){var h=this;if(i===void 0)i=c;if(typeof g===f||!g)return undefined;var j="NotHttps",o="InvalidUrl",n=h.isIE(),b={protocol:undefined,hostname:undefined,host:undefined,port:undefined,pathname:undefined,search:undefined,hash:undefined,isPortPartOfUrl:undefined};try{if(n){var a=document.createElement("a");a.href=g;if(!a||!a.protocol||!a.host||!a.hostname||!a.href||h.cleanUrl(a.href).toLowerCase()!==h.cleanUrl(g).toLowerCase())throw o;if(OSF.OUtil.checkFlight(OSF.FlightNames.AddinEnforceHttps))if(i&&a.protocol!=k)throw new Error(j);var m=h.getRedundandPortString(g,a);b.protocol=a.protocol;b.hostname=a.hostname;b.port=m==e?a.port:e;b.host=m!=e?a.hostname:a.host;b.pathname=(n?"/":e)+a.pathname;b.search=a.search;b.hash=a.hash;b.isPortPartOfUrl=h.containsPort(g,a.protocol,a.hostname,a.port)}else{var d=new URL(g);if(d&&d.protocol&&d.host&&d.hostname){if(OSF.OUtil.checkFlight(OSF.FlightNames.AddinEnforceHttps))if(i&&d.protocol!=k)throw new Error(j);b.protocol=d.protocol;b.hostname=d.hostname;b.port=d.port;b.host=d.host;b.pathname=d.pathname;b.search=d.search;b.hash=d.hash;b.isPortPartOfUrl=d.host.lastIndexOf(":"+d.port)==d.host.length-d.port.length-1}}}catch(l){if(l.message===j)throw l}return b},shallowCopy:function(b){if(b==a)return a;else if(!(b instanceof Object))return b;else if(Array.isArray(b)){for(var e=[],d=0;d<b.length;d++)e.push(b[d]);return e}else{var f=b.constructor();for(var c in b)if(b.hasOwnProperty(c))f[c]=b[c];return f}},createObject:function(b){var d=a;if(b){d={};for(var e=b.length,c=0;c<e;c++)d[b[c].name]=b[c].value}return d},addClass:function(a,b){if(!OSF.OUtil.hasClass(a,b)){var c=a.getAttribute(n);if(c)a.setAttribute(n,c+" "+b);else a.setAttribute(n,b)}},removeClass:function(b,c){if(OSF.OUtil.hasClass(b,c)){var a=b.getAttribute(n),d=new RegExp("(\\s|^)"+c+"(\\s|$)");a=a.replace(d,e);b.setAttribute(n,a)}},hasClass:function(c,b){var a=c.getAttribute(n);return a&&a.match(new RegExp("(\\s|^)"+b+"(\\s|$)"))},focusToFirstTabbable:function(e,i){var g,h=c,f,j=function(){h=b},k=function(c,a,b){if(a<0||a>c)return d;else if(a===0&&b)return d;else if(a===c-1&&!b)return d;if(b)return a-1;else return a+1};e=x(e);g=i?e.length-1:0;if(e.length===0)return a;while(!h&&g>=0&&g<e.length){f=e[g];window.focus();f.addEventListener(l,j);f.focus();f.removeEventListener(l,j);g=k(e.length,g,i);if(!h&&f===document.activeElement)h=b}if(h)return f;else return a},focusToNextTabbable:function(f,o,m){var j,e,h=c,g,k=function(){h=b},n=function(b,c){for(var a=0;a<b.length;a++)if(b[a]===c)return a;return d},i=function(c,a,b){if(a<0||a>c)return d;else if(a===0&&b)return d;else if(a===c-1&&!b)return d;if(b)return a-1;else return a+1};f=x(f);j=n(f,o);e=i(f.length,j,m);if(e<0)return a;while(!h&&e>=0&&e<f.length){g=f[e];g.addEventListener(l,k);g.focus();g.removeEventListener(l,k);e=i(f.length,e,m);if(!h&&g===document.activeElement)h=b}if(h)return g;else return a},isNullOrUndefined:function(d){if(typeof d===f)return b;if(d===a)return b;return c},stringEndsWith:function(d,a){if(!OSF.OUtil.isNullOrUndefined(d)&&!OSF.OUtil.isNullOrUndefined(a)){if(a.length>d.length)return c;if(d.substr(d.length-a.length)===a)return b}return c},hashCode:function(b){var a=0;if(!OSF.OUtil.isNullOrUndefined(b)){var c=0,d=b.length;while(c<d)a=(a<<5)-a+b.charCodeAt(c++)|0}return a},getValue:function(a,b){if(OSF.OUtil.isNullOrUndefined(a))return b;return a},externalNativeFunctionExists:function(a){return a==="unknown"||a!==f}}}();OSF.OUtil.Guid=function(){var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return {generateNewGuid:function(){for(var c="",d=(new Date).getTime(),b=0;b<32&&d>0;b++){if(b==8||b==12||b==16||b==20)c+="-";c+=a[d%16];d=Math.floor(d/16)}for(;b<32;b++){if(b==8||b==12||b==16||b==20)c+="-";c+=a[Math.floor(Math.random()*16)]}return c}}}();try{(function(){OSF.Flights=OSF.OUtil.parseFlights(true)})()}catch(ex){}window.OSF=OSF;(function(g){var c="\n",d=true,a=null,b="undefined",j=function(){function c(){}c.isInstanceOfType=function(f,e){if(typeof e===b||e===a)return false;if(e instanceof f)return d;var c=e.constructor;if(!c||typeof c!=="function"||!c.__typeName||c.__typeName==="Object")c=Object;return !!(c===f)||c.__typeName&&f.__typeName&&c.__typeName===f.__typeName};return c}();g.MsAjaxTypeHelper=j;var h=function(){var e="Parameter name: {0}";function d(){}d.create=function(c,b){var a=new Error(c);a.message=c;if(b)for(var d in b)a[d]=b[d];a.popStackFrame();return a};d.parameterCount=function(a){var c="Sys.ParameterCountException: "+(a?a:"Parameter count mismatch."),b=d.create(c,{name:"Sys.ParameterCountException"});b.popStackFrame();return b};d.argument=function(a,g){var b="Sys.ArgumentException: "+(g?g:"Value does not fall within the expected range.");if(a)b+=c+f.format(e,a);var h=d.create(b,{name:"Sys.ArgumentException",paramName:a});h.popStackFrame();return h};d.argumentNull=function(a,g){var b="Sys.ArgumentNullException: "+(g?g:"Value cannot be null.");if(a)b+=c+f.format(e,a);var h=d.create(b,{name:"Sys.ArgumentNullException",paramName:a});h.popStackFrame();return h};d.argumentOutOfRange=function(i,g,j){var h="Sys.ArgumentOutOfRangeException: "+(j?j:"Specified argument was out of the range of valid values.");if(i)h+=c+f.format(e,i);if(typeof g!==b&&g!==a)h+=c+f.format("Actual value was {0}.",g);var k=d.create(h,{name:"Sys.ArgumentOutOfRangeException",paramName:i,actualValue:g});k.popStackFrame();return k};d.argumentType=function(h,g,b,i){var a="Sys.ArgumentTypeException: ";if(i)a+=i;else if(g&&b)a+=f.format("Object of type '{0}' cannot be converted to type '{1}'.",g.getName?g.getName():g,b.getName?b.getName():b);else a+="Object cannot be converted to the required type.";if(h)a+=c+f.format(e,h);var j=d.create(a,{name:"Sys.ArgumentTypeException",paramName:h,actualType:g,expectedType:b});j.popStackFrame();return j};d.argumentUndefined=function(a,g){var b="Sys.ArgumentUndefinedException: "+(g?g:"Value cannot be undefined.");if(a)b+=c+f.format(e,a);var h=d.create(b,{name:"Sys.ArgumentUndefinedException",paramName:a});h.popStackFrame();return h};d.invalidOperation=function(a){var c="Sys.InvalidOperationException: "+(a?a:"Operation is not valid due to the current state of the object."),b=d.create(c,{name:"Sys.InvalidOperationException"});b.popStackFrame();return b};return d}();g.MsAjaxError=h;var f=function(){function a(){}a.format=function(c){for(var b=[],a=1;a<arguments.length;a++)b[a-1]=arguments[a];var d=c;return d.replace(/{(\d+)}/gm,function(d,a){var c=parseInt(a,10);return b[c]===undefined?"{"+a+"}":b[c]})};a.startsWith=function(b,a){return b.substr(0,a.length)===a};return a}();g.MsAjaxString=f;var i=function(){function a(){}a.trace=function(){};return a}();g.MsAjaxDebug=i;if(!OsfMsAjaxFactory.isMsAjaxLoaded()){var e=function(b,d,c){if(b.__typeName===undefined||b.__typeName===a)b.__typeName=d;if(b.__class===undefined||b.__class===a)b.__class=c};e(Function,"Function",d);e(Error,"Error",d);e(Object,"Object",d);e(String,"String",d);e(Boolean,"Boolean",d);e(Date,"Date",d);e(Number,"Number",d);e(RegExp,"RegExp",d);e(Array,"Array",d);if(!Function.createCallback)Function.createCallback=function(b,a){var c=Function._validateParams(arguments,[{name:"method",type:Function},{name:"context",mayBeNull:d}]);if(c)throw c;return function(){var e=arguments.length;if(e>0){for(var d=[],c=0;c<e;c++)d[c]=arguments[c];d[e]=a;return b.apply(this,d)}return b.call(this,a)}};if(!Function.createDelegate)Function.createDelegate=function(b,c){var a=Function._validateParams(arguments,[{name:"instance",mayBeNull:d},{name:"method",type:Function}]);if(a)throw a;return function(){return c.apply(b,arguments)}};if(!Function._validateParams)Function._validateParams=function(i,g,e){var c,f=g.length;e=e||typeof e===b;c=Function._validateParameterCount(i,g,e);if(c){c.popStackFrame();return c}for(var d=0,k=i.length;d<k;d++){var h=g[Math.min(d,f-1)],j=h.name;if(h.parameterArray)j+="["+(d-f+1)+"]";else if(!e&&d>=f)break;c=Function._validateParameter(i[d],h,j);if(c){c.popStackFrame();return c}}return a};if(!Function._validateParameterCount)Function._validateParameterCount=function(m,f,l){var b,e,c=f.length,g=m.length;if(g<c){var i=c;for(b=0;b<c;b++){var j=f[b];if(j.optional||j.parameterArray)i--}if(g<i)e=d}else if(l&&g>c){e=d;for(b=0;b<c;b++)if(f[b].parameterArray){e=false;break}}if(e){var k=h.parameterCount();k.popStackFrame();return k}return a};if(!Function._validateParameter)Function._validateParameter=function(e,c,j){var d,i=c.type,n=!!c.integer,m=!!c.domElement,o=!!c.mayBeNull;d=Function._validateParameterType(e,i,n,m,o,j);if(d){d.popStackFrame();return d}var g=c.elementType,h=!!c.elementMayBeNull;if(i===Array&&typeof e!==b&&e!==a&&(g||!h))for(var l=!!c.elementInteger,k=!!c.elementDomElement,f=0;f<e.length;f++){var p=e[f];d=Function._validateParameterType(p,g,l,k,h,j+"["+f+"]");if(d){d.popStackFrame();return d}}return a};if(!Function._validateParameterType)Function._validateParameterType=function(d,e,j,i,h,f){var c,k;if(typeof d===b)if(h)return a;else{c=g.MsAjaxError.argumentUndefined(f);c.popStackFrame();return c}if(d===a)if(h)return a;else{c=g.MsAjaxError.argumentNull(f);c.popStackFrame();return c}if(e&&!g.MsAjaxTypeHelper.isInstanceOfType(e,d)){c=g.MsAjaxError.argumentType(f,typeof d,e);c.popStackFrame();return c}return a};if(!window.Type)window.Type=Function;if(!Type.registerNamespace)Type.registerNamespace=function(d){for(var c=d.split("."),b=window,a=0;a<c.length;a++){b[c[a]]=b[c[a]]||{};b=b[c[a]]}};if(!Type.prototype.registerClass)Type.prototype.registerClass=function(a){a={}};typeof Sys===b&&Type.registerNamespace("Sys");if(!Error.prototype.popStackFrame)Error.prototype.popStackFrame=function(){var d=this;if(arguments.length!==0)throw h.parameterCount();if(typeof d.stack===b||d.stack===a||typeof d.fileName===b||d.fileName===a||typeof d.lineNumber===b||d.lineNumber===a)return;var e=d.stack.split(c),g=e[0],j=d.fileName+":"+d.lineNumber;while(typeof g!==b&&g!==a&&g.indexOf(j)===-1){e.shift();g=e[0]}var i=e[1];if(typeof i===b||i===a)return;var f=i.match(/@(.*):(\d+)$/);if(typeof f===b||f===a)return;d.fileName=f[1];d.lineNumber=parseInt(f[2]);e.shift();d.stack=e.join(c)};OsfMsAjaxFactory.msAjaxError=h;OsfMsAjaxFactory.msAjaxString=f;OsfMsAjaxFactory.msAjaxDebug=i}})(OfficeExt||(OfficeExt={}));OSF.SupportedLocales={"ar-sa":true,"bg-bg":true,"bn-in":true,"ca-es":true,"cs-cz":true,"da-dk":true,"de-de":true,"el-gr":true,"en-us":true,"es-es":true,"et-ee":true,"eu-es":true,"fa-ir":true,"fi-fi":true,"fr-fr":true,"gl-es":true,"he-il":true,"hi-in":true,"hr-hr":true,"hu-hu":true,"id-id":true,"it-it":true,"ja-jp":true,"kk-kz":true,"ko-kr":true,"lo-la":true,"lt-lt":true,"lv-lv":true,"ms-my":true,"nb-no":true,"nl-nl":true,"nn-no":true,"pl-pl":true,"pt-br":true,"pt-pt":true,"ro-ro":true,"ru-ru":true,"sk-sk":true,"sl-si":true,"sr-cyrl-cs":true,"sr-cyrl-rs":true,"sr-latn-cs":true,"sr-latn-rs":true,"sv-se":true,"th-th":true,"tr-tr":true,"uk-ua":true,"ur-pk":true,"vi-vn":true,"zh-cn":true,"zh-tw":true};OSF.AssociatedLocales={ar:"ar-sa",bg:"bg-bg",bn:"bn-in",ca:"ca-es",cs:"cs-cz",da:"da-dk",de:"de-de",el:"el-gr",en:"en-us",es:"es-es",et:"et-ee",eu:"eu-es",fa:"fa-ir",fi:"fi-fi",fr:"fr-fr",gl:"gl-es",he:"he-il",hi:"hi-in",hr:"hr-hr",hu:"hu-hu",id:"id-id",it:"it-it",ja:"ja-jp",kk:"kk-kz",ko:"ko-kr",lo:"lo-la",lt:"lt-lt",lv:"lv-lv",ms:"ms-my",nb:"nb-no",nl:"nl-nl",nn:"nn-no",pl:"pl-pl",pt:"pt-br",ro:"ro-ro",ru:"ru-ru",sk:"sk-sk",sl:"sl-si",sr:"sr-cyrl-cs",sv:"sv-se",th:"th-th",tr:"tr-tr",uk:"uk-ua",ur:"ur-pk",vi:"vi-vn",zh:"zh-cn"};OSF.getSupportedLocale=function(a,c){if(c===void 0)c="en-us";if(!a)return c;var b;a=a.toLowerCase();if(a in OSF.SupportedLocales)b=a;else{var d=a.split("-",1);if(d&&d.length>0)b=OSF.AssociatedLocales[d[0]]}if(!b)b=c;return b};var InfoType;(function(a){var c="SecurityInfo",b="Information";a[a["Error"]=0]="Error";a[a["Warning"]=1]="Warning";a[a[b]=2]=b;a[a[c]=3]=c})(InfoType||(InfoType={}));var TrustResult;(function(a){var b="Prompting";a[a["Unknown"]=0]="Unknown";a[a["Trusted"]=1]="Trusted";a[a[b]=2]=b})(TrustResult||(TrustResult={}));var SupportedError={APICallFailed:true,NotTrustedWAC:true};function _loadJs(c,b){var a=document.createElement("script");a.src=c;a.type="text/javascript";a.addEventListener("load",b);document.getElementsByTagName("head")[0].appendChild(a)}var PathToStringFile="../{locale}/office_strings.js",Strings={};function _getUrlParams(){var a=window.location.hash.replace("#","");a=decodeURIComponent(a);return JSON.parse(a)}function _loadStrings(c,b){var a=OSF.getSupportedLocale(c),d=PathToStringFile.replace("{locale}",a);_loadJs(d,b)}function _getConfirmedResultKey(a,b){return "OfficeJSTrustKeyV2_"+(b?"http_":"https_")+a}function _hostTrustResult(c,d){var b=OSF.OUtil.getLocalStorage(),a=JSON.parse(b.getItem(_getConfirmedResultKey(c,d)));return a?a.Result:TrustResult.Unknown}function _confirmHost(a,b,f){var e=_getConfirmedResultKey(a,b),c=e+"TimeStamp",d=_hostTrustResult(a,b);if(d==TrustResult.Prompting){var i=OSF.OUtil.getLocalStorage(),h=JSON.parse(i.getItem(c)),j=Date.now()-h;if(j>=3e4)d=TrustResult.Unknown}switch(+d){case TrustResult.Unknown:function k(){var d=OSF.OUtil.getLocalStorage(),f={Result:TrustResult.Prompting};d.setItem(e,JSON.stringify(f));d.setItem(c,JSON.stringify(Date.now()));var g=Strings.OfficeOM["L_ConfirmDialog"].replace("{0}",a);if(b)g+=" "+Strings.OfficeOM["L_NoHttpsWAC"];var h=confirm(g);f.Result=h?TrustResult.Trusted:TrustResult.Unknown;d.setItem(e,JSON.stringify(f));d.removeItem(c);return h}f(k());break;case TrustResult.Trusted:f(true);break;case TrustResult.Prompting:function g(){OSF.OUtil.removeEventListener(window,"storage",g);var c=_hostTrustResult(a,b);f(c==TrustResult.Trusted)}OSF.OUtil.addEventListener(window,"storage",g)}}function _showInfoBar(E,C,h,A){var o="display:none",e="style",n="br",s="moe-infobar-message",m="span",z="presentation",b="class",l="div",x=h;if(h.length>255)h=h.substring(0,254);var p=document.createElement(l);p.setAttribute(b,"moe-infobar-body");var B=document.createElement(l);B.innerHTML=x;p.setAttribute("title",B.textContent);var j=document.createElement("table");j.setAttribute(b,"moe-infobar-infotable");j.setAttribute("role",z);for(var D,w=0;w<3;w++){D=j.insertRow(w);D.setAttribute("role",z)}var a=j.rows;a[0].insertCell(0);a[0].insertCell(1);a[0].cells[1].setAttribute("rowSpan","2");a[1].insertCell(0);a[1].insertCell(1);a[2].insertCell(0);a[2].insertCell(1);a[0].cells[0].setAttribute(b,"moe-infobar-top-left-cell");a[0].cells[1].setAttribute(b,"moe-infobar-message-cell");a[2].cells[1].setAttribute(b,"moe-infobar-button-cell");var k=document.createElement("img");k.src="images/moe_status_icons.png";var i,t=InfoType.Error;if(t===InfoType.Error)i="moe-infobar-error";else if(t===InfoType.Warning)i="moe-infobar-warning";else if(t===InfoType.Information)i="moe-infobar-info";else i="moe-infobar-secinfo";k.setAttribute(b,i);k.setAttribute("alt",x);a[0].cells[0].appendChild(k);var c=document.createElement("a");c.setAttribute(b,"moe-infobar-message-div");c.setAttribute("tabindex","1");if(A){var u=document.createElement(m);u.setAttribute(b,"moe-infobar-title");u.innerHTML=A;c.appendChild(u)}var v=document.createElement(m);v.setAttribute(b,s);v.innerHTML=h;c.appendChild(v);if(C){var q=document.createElement(m);q.setAttribute(b,s);q.innerHTML=Strings.OfficeOM["L_NoHttpsWAC"];c.appendChild(document.createElement(n));c.appendChild(document.createElement(n));c.appendChild(q);c.appendChild(document.createElement(n));c.appendChild(document.createElement(n))}a[0].cells[1].appendChild(c);var f=document.createElement(m);f.setAttribute(b,s);f.setAttribute(e,o);f.innerHTML=Strings.OfficeOM["L_ConfirmCancelMessage"];var g=document.createElement("button");g.setAttribute(b,"moe-infobar-button");g.setAttribute("type","button");g.innerHTML=Strings.OfficeOM["L_ContinueButton"];g.onclick=function(){_confirmHost(E,C,function(a){if(a)f.innerHTML=Strings.OfficeOM["L_ConfirmRefreshMessage"];g.setAttribute(e,o);f.removeAttribute(e)})};a[2].cells[1].appendChild(g);a[2].cells[1].appendChild(f);p.appendChild(j);var d=document.createElement(l);d.setAttribute(b,"moe-background");d.style.backgroundImage="url(images/agavedefaulticon96x96.png)";d.style.backgroundColor="white";d.style.opacity="1";d.style.filter="alpha(opacity=100)";d.style.backgroundRepeat="no-repeat";d.style.backgroundPosition="center";var r=document.createElement(l);r.setAttribute(b,"moe-infobar-out");r.appendChild(p);d.appendChild(r);var y=document.getElementById("container");y&&y.appendChild(d)}try{var urlParams_1=_getUrlParams(),e=Function._validateParams(urlParams_1,[{name:"error",type:String,mayBeNull:false},{name:"locale",type:String,mayBeNull:false},{name:"hostname",type:String,mayBeNull:false},{name:"noHttps",type:Boolean,mayBeNull:false},{name:"validate",type:Boolean,mayBeNull:false}]);if(!e){var locale_1=window.navigator.language;if(urlParams_1.validate){function validateHostnameTrust(b){var a=JSON.parse(b.data),f=Function._validateParams(a,[{name:"hostname",type:String,mayBeNull:false},{name:"noHttps",type:Boolean,mayBeNull:false}]);if(!f){var d=_hostTrustResult(a.hostname,a.noHttps),c=d===TrustResult.Trusted;if(!c)_loadStrings(locale_1,function(){_confirmHost(a.hostname,a.noHttps,function(a){var c={hostUserTrusted:a};b.source.postMessage(JSON.stringify(c),b.origin)})});else{var e={hostUserTrusted:c};b.source.postMessage(JSON.stringify(e),b.origin)}}}OSF.OUtil.addEventListener(window,"message",validateHostnameTrust)}else _loadStrings(locale_1,function(){SupportedError[urlParams_1.error]&&_showInfoBar(urlParams_1.hostname,urlParams_1.noHttps,Strings.OfficeOM["L_"+urlParams_1.error])})}}catch(err){}