/*
 Copyright 2020 Mpowered Ventures Ltd.
 All rights reserved. info@mpowered.biz
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};
$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f<e.length-1;f++){var g=e[f];if(!(g in d))return;d=d[g]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&($jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+e,e=
$jscomp.propertyToPolyfillSymbol[e],$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("Object.is",function(a){return a?a:function(a,c){return a===c?0!==a||1/a===1/c:a!==a&&c!==c}},"es6","es3");$jscomp.polyfill("Array.prototype.includes",function(a){return a?a:function(a,c){var b=this;b instanceof String&&(b=String(b));var e=b.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var f=b[c];if(f===a||Object.is(f,a))return!0}return!1}},"es7","es3");
$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};$jscomp.polyfill("String.prototype.includes",function(a){return a?a:function(a,c){return-1!==$jscomp.checkStringArgs(this,a,"includes").indexOf(a,c||0)}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var e=b.length,f=a.length;c=Math.max(0,Math.min(c|0,b.length));for(var g=0;g<f&&c<e;)if(b[c++]!=a[g++])return!1;return g>=f}},"es6","es3");$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");window.fb_site_debug=!0;var path=window.location.pathname,urlParams=new URLSearchParams(window.location.search);
setTimeout(function(){"Login.aspx"==path.substring(path.lastIndexOf("/")+1)&&(urlParams.get("userid")&&urlParams.get("tender")?(window.fb_site_debug&&console.log("Login.aspx: Site.js found urlParams userid and tender"),$("#userid").val(urlParams.get("userid")),$("#password").val("**AUTOLOGIN**"),$("#tender").val(urlParams.get("tender")),window.fb_site_debug&&(console.log("Login.aspx: Site.js: $('#userid').val(): "+$("#userid").val()),console.log("Login.aspx: Site.js: $('#password').val(): "+$("#password").val()),
console.log("Login.aspx: Site.js: $('#tender').val(): "+$("#tender").val())),$("#submitBtn").click().prop("disabled",!0).val("Logging in...")):$("#password").val(""),$("#userid").val()?($("#password").focus(),$("#password").prop("selectionStart",$("#password").val().length),$("#password").prop("selectionEnd",$("#password").val().length)):$("#userid").focus());window.removeEventListener("message",receiveMessage,!1);window.addEventListener("message",receiveMessage,!1);window.fb_site_debug&&console.log("Site.js: added event listener for iframe messages from parent")},
250);document.removeEventListener("readystatechange",hndlEvntListenerReadystatechange,!1);document.addEventListener("readystatechange",hndlEvntListenerReadystatechange,!1);function hndlEvntListenerReadystatechange(a){window.fb_site_debug&&console.log("Site.js: ***** readyState changed to:",document.readyState);"interactive"===document.readyState?window.deviceScreenManagement():"complete"===document.readyState&&(window.enableParentButtons(),processReacts())}
window.addEventListener("orientationchange",function(){window.deviceScreenManagement()});window.addEventListener("resize",function(){window.deviceScreenManagement()});
function deviceScreenManagement(){var a=576>window.innerWidth?1:1.2,b=1/a,c=window.scrollY*b,d=.75*window.innerHeight;window.fb_site_debug&&console.log("deviceScreenManagement(): "+window.innerWidth+" px(w) x "+window.innerHeight+" + px(h) scaleFactor: "+a+" inverseScale: "+b+" scrollOffset: "+c);document.body.style.transform="scale("+String(a)+")";document.body.style.transformOrigin="0 0";document.body.style.width=String(100/a)+"%";["wfaddpanel","atmtaddpanel"].forEach(function(a){if(a=document.getElementById(a))$(a).css("width",
$("#mask").width()-30+"px"),$(a).css("height",window.innerHeight+"px"),a.style.transform="translateY("+c+"px)",a.style.maxHeight=d+"px",a.style.overflowY="auto"});$("#loading-image").css("margin-top",c+50+"px");$(".dataTable").each(function(){$(this).DataTable().table().draw()})}
function enableParentButtons(){window.parent.postMessage({type:"iframe-home-button-control",action:"enable"},window.location.origin);window.location.hash.includes("#startpage")?window.fb_site_debug&&console.log("FieldBlade: found #startpage, so not enabling the parent Back button"):window.parent.postMessage({type:"iframe-back-button-control",action:"enable"},window.location.origin)}
function receiveMessage(a){a.origin===window.location.origin?"goBack"===a.data?window.location.hash.includes("#startpage")?window.fb_site_debug&&console.log("FieldBlade: found #startpage, so ignoring goBack request"):(window.parent.postMessage({type:"iframe-back-button-control",action:"disable"},window.location.origin),window.parent.postMessage({type:"iframe-home-button-control",action:"disable"},window.location.origin),$("#loading").show(),window.history.back()):"goHome"===a.data&&(window.parent.postMessage({type:"iframe-back-button-control",
action:"disable"},window.location.origin),window.parent.postMessage({type:"iframe-home-button-control",action:"disable"},window.location.origin),$("#loading").show(),window.location.href="Index.aspx"):console.warn("FieldBlade: Message received from untrusted origin:",a.origin)}
function hndlEvntListenerClick(a){function b(){window.parent.postMessage({type:"iframe-back-button-control",action:"disable"},window.location.origin);window.parent.postMessage({type:"iframe-home-button-control",action:"disable"},window.location.origin)}function c(a){a=a.target.closest("a").getAttribute("href").toLowerCase();return a.startsWith("#")||a.startsWith("mailto:")||a.startsWith("tel:")||a.startsWith("mpowered-")}"A"===a.target.tagName||"SPAN"===a.target.tagName?"_blank"===a.target.closest("a").getAttribute("target")||
c(a)||(b(),window.deviceScreenManagement(),$("#loading").show()):"INPUT"===a.target.tagName&&"submit"===a.target.getAttribute("type")&&a.target.form.checkValidity()&&(b(),window.deviceScreenManagement(),$("#loading").show())}document.removeEventListener("click",hndlEvntListenerClick,!1);document.addEventListener("click",hndlEvntListenerClick,!1);window.addEventListener("pageshow",function(a){a.persisted&&$("#loading").hide()});
function addReacts(a){window.fb_site_debug&&console.log("addReacts: received xmlString: "+a);window.g_reacts=a}window.xapp="";
function decorateAnchors(){["FieldPro","FieldTicket","FieldCall","FieldBlade"].includes(window.xapp)&&"iOS"===window.getMobileOperatingSystem()&&(window.fb_site_debug&&console.log("decorateAnchors(): : xapp IS a FieldApp running on iOS, so checking anchors on page..."),document.querySelectorAll('a[href^="http"], a[href^="mailto"], a[href^="tel"]').forEach(function(a){var b=a.getAttribute("href"),c=!1;b&&(b.startsWith("http")?(c=!0,b=b.replace("http","mpowered-http")):b.startsWith("mailto")?(c=!0,
b=b.replace("mailto","mpowered-mailto")):b.startsWith("tel")&&(c=!0,b=b.replace("tel","mpowered-tel")),a.setAttribute("href",b),window.fb_site_debug&&c&&console.log("decorateAnchors(): changed href to: "+b))}))}
function processReacts(){if(window.g_reacts)try{var a=$.parseXML(window.g_reacts),b="",c=$(a).find("reacts").find("x");for(a=0;a<c.length;++a){var d=$(c[a].innerHTML).filter("react"),e=decodeURIComponent(d.attr("action")),f=decodeURIComponent(d.attr("value1")),g=decodeURIComponent(d.attr("value2"));window.fb_site_debug&&console.log("processing react: "+e+" value1: "+f+" value2: "+g);b+=e+" value1: "+f+" value2: "+g+"<br>";switch(e){case "versionpkg":window.parent.postMessage({type:"iframe-versionpkg",
action:f},window.location.origin);window.fb_site_debug&&console.log("React: posted message iframe-versionpkg: "+f);break;case "xapp":window.fb_site_debug&&console.log("React: found xapp: "+f);["FieldPro","FieldTicket","FieldCall"].includes(f)&&(window.xapp=f,window.fb_site_debug&&console.log("React: set window.xapp to: "+window.xapp));window.decorateAnchors();document.querySelectorAll(".tag-in-"+f).forEach(function(a){a.style.display=""});document.querySelectorAll(".tag-in-parent").forEach(function(a){function b(a){window.fb_site_debug&&
console.log("in click handler for .tag-in-parent link, about to postMessage to parent: type: iframe-tag-account action: "+this.dataset.account);a.preventDefault();window.parent.postMessage({type:"iframe-tag-account",action:this.dataset.account},window.location.origin);window.fb_site_debug&&console.log("message posted")}a.removeEventListener("click",b);a.addEventListener("click",b)});break;case "xacct":window.fb_site_debug&&console.log("React: found xacct: "+f);highlightWord(f);break;default:window.fb_site_debug&&
console.log("***NO JS HANDLER*** found for react: "+e)}}if(b){var h=document.getElementById("dbgReacts");h&&(h.innerHTML="<u>Reacts:</u><br>"+b)}}catch(k){console.error("processReacts: general error processing reacts: ",k)}}
function highlightWord(a,b){function c(a){var b=[];for(a=a.firstChild;a;a=a.nextSibling)3===a.nodeType?b.push(a):b=b.concat(c(a));return b}b=void 0===b?"highlighted":b;var d=new RegExp("\\b"+a+"\\b","gi");c(document.body).forEach(function(a){var c=a.nodeValue,e=c.replace(d,'<span class="'+b+'">$&</span>');if(e!==c){c=document.createElement("div");for(c.innerHTML=e;c.firstChild;)a.parentNode.insertBefore(c.firstChild,a);a.parentNode.removeChild(a)}})}
function getMobileOperatingSystem(){var a="NotIosDroidWin",b=navigator.userAgent||navigator.vendor||window.opera;console.log("userAgent="+b);/windows phone/i.test(b)&&(a="Windows Phone");/android/i.test(b)&&(a="Android");/iPad|iPhone|iPod/.test(b)&&!window.MSStream?a="iOS":b.includes("Mac")&&"ontouchend"in document&&(a="iOS");var c=document.getElementById("dbgUserAgent");c&&(c.innerHTML=b+"<br>derived mobileOS for FB: "+a);return a}
function dateToYYYYMMDDHHMISS(a){var b=a.getFullYear().toString(),c=(a.getMonth()+1).toString(),d=a.getDate().toString(),e=a.getHours().toString(),f=a.getMinutes().toString();a=a.getSeconds().toString();return b+(c[1]?c:"0"+c[0])+(d[1]?d:"0"+d[0])+(e[1]?e:"0"+e[0])+(f[1]?f:"0"+f[0])+(a[1]?a:"0"+a[0])}
function imageThumbnailsPostProcessing(){window.fb_site_debug&&console.log("in Site.js imageThumbnailsPostProcessing()");$(".thumb-image").unbind("click");$(".thumb-image").click(function(a){var b=$("#wrndiv"+$(this).data("wrndiv"));window.fb_site_debug&&console.log("clicked thumb-image: status: "+this.getAttribute("data-status"));if("href"!==this.getAttribute("data-status"))if(a.preventDefault(),b.hide(),"inline"===this.getAttribute("data-status"))try{window.open(null,"_blank","","").document.write('<html><center><img src="'+
$(this).find("img").attr("src")+'"></center></html>')}catch(c){}else"dlreq"===this.getAttribute("data-status")&&(window.blobDownloader(this),window.setTimeout(function(){window.decorateAnchors()},500))})}
function blobDownloader(a){window.fb_site_debug&&console.log("in Site.js blobDownloader()");var b=$("#wrndiv"+$(a).data("wrndiv")),c='<a href="#" id="wrn-'+$(a).data("wrndiv")+'-close-btn" class="btn btn-default btn-xs" role="button">Close</a>';var d=decodeURIComponent($("#POSTEDGETX").val());d=$.parseXML(d);$(d).find("v06")[0].innerHTML=decodeURIComponent($(d).find("v06")[0].innerHTML);$(d).find("v06")[0].innerHTML="";window.fb_site_debug&&console.log("v06: "+$(d).find("v06")[0].innerHTML);d=(new window.XMLSerializer).serializeToString(d);
window.fb_site_debug&&console.log("assembled postedGET: "+d);var e="";e='<root blobdownloader="Y"><source>'+(encodeURIComponent($(a).data("wrndiv"))+"</source>");e+="<recordid>"+encodeURIComponent($(a).data("id"))+"</recordid>";e+="<filename>"+encodeURIComponent($(a).data("filename"))+"</filename>";e+="</root>";window.fb_site_debug&&console.log("assembled postedXML: "+(250>=e.length?e:e.substr(0,250)+"... +"+(e.length-250)+"bytes"));window.fb_site_debug&&console.log("About to AJAX web service: WebProxy.asmx/webproxy calling wsmethod: blobdownloader");
$("#loading").show();d=$.post("WebProxy.asmx/webproxy",{wsmethod:"blobdownloader",postedGET:encodeURIComponent(d),postedXML:encodeURIComponent(e)});d.always(function(){window.enableParentButtons();$("#loading").hide()});d.fail(function(){$(a).find("img").attr("src","images/download-w.png");b.html("ERROR: Oh snap, it looks like we hit a glitch. Please try again, and it may magically fix itself. If not, please report the error: ajax comm failure URL: WebProxy.asmx/webproxy<br><br>"+c);b.show();$("#wrn-"+
$(a).data("wrndiv")+"-close-btn").click(function(a){a.preventDefault();b.hide()})});d.done(function(d){window.fb_site_debug&&console.log("Raw data returned from web service: "+(250>=d.length?d:d.substr(0,250)+"... +"+(d.length-250)+"bytes"));if("<?xml"!=d.substr(0,5))$(a).find("img").attr("src","images/download-w.png"),b.html("ERROR: xml doc not returned from web service.<br><br>"+c),b.show(),$("#wrn-"+$(a).data("wrndiv")+"-close-btn").click(function(a){a.preventDefault();b.hide()});else if(d=$.parseXML(d),
"OK"!=$(d).find("head").find("r01")[0].innerHTML)$(a).find("img").attr("src","images/download-w.png"),b.html($(d).find("head").find("r01")[0].innerHTML+"<br><br>"+c),b.show(),$("#wrn-"+$(a).data("wrndiv")+"-close-btn").click(function(a){a.preventDefault();b.hide()});else{window.fb_site_debug&&console.log("We're back OK from: blobdownloader");if("IMAGE"==$(a).data("type")){var e=JSON.parse($(d).find("thumbnail")[0].innerHTML);$(a).find("img").prop("src",e.src);$(a).find("img").prop("width",e.width);
$(a).find("img").prop("height",e.height)}else $(a).find("img").attr("src","images/view.png");$(a).removeClass("gremlins-test");a.setAttribute("data-status","href");a.href=decodeURIComponent($(d).find("href")[0].innerHTML);if("iOS"!==window.getMobileOperatingSystem()&&"undefined"===typeof window.runstressing)try{window.open(a.href,"_blank")}catch(h){b.html("Auto-open failed. Please tap the thumbnail to open the image.<br><br>"+c),b.show()}else b.html("Please tap the thumbnail to open the image."),
b.show(),window.setTimeout(function(){b.hide()},2E3)}})}
function attachmentFilesPostProcessing(){window.fb_site_debug&&console.log("in Site.js attachmentFilesPostProcessing()");$(".attach-file").unbind("click");$(".attach-file").click(function(a){var b=this;window.fb_site_debug&&console.log("clicked attach-file: status: "+b.getAttribute("data-status"));if("href"!==b.getAttribute("data-status")){a.preventDefault();$("#wrndivATTACH").hide();a=decodeURIComponent($("#POSTEDGETX").val());a=$.parseXML(a);$(a).find("v06")[0].innerHTML=decodeURIComponent($(a).find("v06")[0].innerHTML);
$(a).find("v06")[0].innerHTML="";window.fb_site_debug&&console.log("v06: "+$(a).find("v06")[0].innerHTML);a=(new window.XMLSerializer).serializeToString(a);window.fb_site_debug&&console.log("assembled postedGET: "+a);var c="";c='<root attachmentdownloader="Y"><filename>'+(encodeURIComponent($(b).data("filename"))+"</filename>");c+="<filedesc>"+encodeURIComponent($(b).data("filedesc"))+"</filedesc>";c+="<filespec>"+encodeURIComponent($(b).data("filespec"))+"</filespec>";c+="<createdon>"+encodeURIComponent($(b).data("createdon"))+
"</createdon>";c+="<createdby>"+encodeURIComponent($(b).data("createdby"))+"</createdby>";c+="</root>";window.fb_site_debug&&console.log("assembled postedXML: "+(250>=c.length?c:c.substr(0,250)+"... +"+(c.length-250)+"bytes"));window.fb_site_debug&&console.log("About to AJAX web service: WebProxy.asmx/webproxy calling wsmethod: attachmentdownloader");$("#loading").show();a=$.post("WebProxy.asmx/webproxy",{wsmethod:"attachmentdownloader",postedGET:encodeURIComponent(a),postedXML:encodeURIComponent(c)});
a.always(function(){window.enableParentButtons();$("#loading").hide()});a.fail(function(){$(b).find("img").attr("src","images/download-w.png");$("#wrndivATTACH").html('ERROR: Oh snap, it looks like we hit a glitch. Please try again, and it may magically fix itself. If not, please report the error: ajax comm failure URL: WebProxy.asmx/webproxy<br><br><a href="#" id="wrn-ATTACH-close-btn" class="btn btn-default btn-xs" role="button">Close</a>');$("#wrndivATTACH").show();$("#wrn-ATTACH-close-btn").click(function(a){a.preventDefault();
$("#wrndivATTACH").hide()})});a.done(function(a){window.fb_site_debug&&console.log("Raw data returned from web service: "+(250>=a.length?a:a.substr(0,250)+"... +"+(a.length-250)+"bytes"));if("<?xml"!=a.substr(0,5))$(b).find("img").attr("src","images/download-w.png"),$("#wrndivATTACH").html('ERROR: xml doc not returned from web service.<br><br><a href="#" id="wrn-ATTACH-close-btn" class="btn btn-default btn-xs" role="button">Close</a>'),$("#wrndivATTACH").show(),$("#wrn-ATTACH-close-btn").click(function(a){a.preventDefault();
$("#wrndivATTACH").hide()});else if(a=$.parseXML(a),"OK"!=$(a).find("head").find("r01")[0].innerHTML)$(b).find("img").attr("src","images/download-w.png"),$("#wrndivATTACH").html($(a).find("head").find("r01")[0].innerHTML+'<br><br><a href="#" id="wrn-ATTACH-close-btn" class="btn btn-default btn-xs" role="button">Close</a>'),$("#wrndivATTACH").show(),$("#wrn-ATTACH-close-btn").click(function(a){a.preventDefault();$("#wrndivATTACH").hide()});else{try{window.fb_site_debug&&console.log("dbginfo: "+decodeURIComponent($(a).find("dbginfo")[0].innerHTML))}catch(e){}window.fb_site_debug&&
console.log("We're back OK from: attachmentdownloader");$(b).find("img").attr("src","images/view.png");$(b).removeClass("gremlins-test");b.setAttribute("data-status","href");b.href=decodeURIComponent($(a).find("href")[0].innerHTML);if("iOS"!==window.getMobileOperatingSystem()&&"undefined"===typeof window.runstressing)try{window.open(b.href,"_blank")}catch(e){$("#wrndivATTACH").html('Auto-open failed. Please tap the thumbnail to open the document.<br><br><a href="#" id="wrn-ATTACH-close-btn" class="btn btn-default btn-xs" role="button">Close</a>'),
$("#wrndivATTACH").show()}else $("#wrndivATTACH").html("Please tap the thumbnail to open the document."),$("#wrndivATTACH").show(),window.setTimeout(function(){$("#wrndivATTACH").hide()},2E3)}})}})};
