text: (function(fns){var asap=function(e){setTimeout(e,0)};fns.Net={Ajax:function(){var e=this;var o=arguments;if(!o||o.length<=0){fns.ExceptionProcess.Process("no arguments!","Net.Ajax");return}var t={};if(o.length==1){if(typeof o[0]=="object"){t=o[0]}else if(typeof o[0]=="string"){t.url=o[0]}else{fns.ExceptionProcess.Process("Invalid arguments!","Net.Ajax")}}else{t.url=o[0];if(o.length>1)t.method=o[1];if(o.length>2)t.postdata=o[2];if(o.length>3)t.returntype=o[3];if(o.length>4)t.headerdata=o[4];if(o.length>5)t.async=o[5]}var r={url:"",method:"post",returntype:"json",postdata:{},headerdata:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","POWERED-BY-EFFC":"Approve","x-requested-with":"XMLHttpRequest"},async:true,progress:null};var s=fns.extend(true,r,t);if(s.async){s.headerdata["x-request-async"]="true"}var n=this.xhr();return new Promise(function(o,t){try{n.onreadystatechange=function(){if(n.readyState===4){if(n.status===200){var r=FormatResponseData(n);e.ResponseDataPreProcess(s,r,o,t)}else{t({errorCode:n.status,errorMsg:""})}}};n.upload.addEventListener("progress",function(e){if(s.progress){if(e.lengthComputable){s.progress(e.loaded,e.total)}}},false);n.open(s.method,s.url,s.async);if(fns.BrowserMatch.browser!="safari"){n.responseType=s.returntype}if(s.headerdata){for(var r in s.headerdata){n.setRequestHeader(r,s.headerdata[r])}}if(FrameNameSpace.Config.Ajax&&FrameNameSpace.Config.Ajax.beforeAjax){if(FrameNameSpace.Config.Ajax.beforeAjax(s)){n.send(GenPostData(s.postdata,s.method,s.headerdata["Content-Type"]))}}else{n.send(GenPostData(s.postdata,s.method,s.headerdata["Content-Type"]))}}catch(e){fns.ExceptionProcess.Process(e,"frame.Net.Ajax");t({errorCode:e.name,errorMsg:e.stack})}})},xhr:function(){xmlhttp=null;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest}else if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}return xmlhttp},WS:function(){var me=this;var args=arguments;if(!args||args.length<=0){fns.ExceptionProcess.Process("no arguments!","Net.WS")}if(!WebSocket){fns.ExceptionProcess.Process("Your browser not support WebSocket","Net.WS")}var options={};if(args.length==1){if(typeof args[0]=="object"){options=args[0]}else if(typeof args[0]=="string"){options.url=args[0]}else{fns.ExceptionProcess.Process("Invalid arguments!","Net.WS")}}else{options.url=args[0];if(args.length>1)options.onopen=args[1];if(args.length>2)options.onmessage=args[2];if(args.length>3)options.onerror=args[3];if(args.length>4)options.onclose=args[4]}var defaults={url:"",onopen:null,onmessage:null,onerror:null,onclose:null};var opts=fns.extend(true,defaults,options);var ws=null;if(opts.url.startWith("http://")){ws=new WebSocket(opts.url.replaceAll("http","ws"))}else if(opts.url.startWith("ws://")){ws=new WebSocket(opts.url)}else{ws=new WebSocket("ws://"+window.location.hostname+(window.location.port==""?"":":"+window.location.port)+"/"+opts.url)}this.WebSocket=ws;this.Send=function(e){var o=this.WebSocket;if(o){o.send(JSON.stringify(e),20971520)}};this.Close=function(){var e=this.WebSocket;if(e){e.close()}};this.IsClose=function(){var e=this.WebSocket;if(e){return e.readyState==e.CLOSED}};this.On=function(e,o){if(typeof o!="function")throw TypeError("On need a function");if(e){var t=e.toLowerCase().startWith("on")?e.toLowerCase():"on"+e;opts[t]=o}return me};asap(function(){try{ws.onopen=function(){if(opts.onopen){opts.onopen(me)}};ws.onmessage=function(evt){if(Object.prototype.toString.call(evt.data)==="[object Blob]"){if(opts.onmessage){opts.onmessage(me,evt.data)}}else{eval("var jobj="+evt.data);if(jobj){if(jobj.ErrorCode==""){if(opts.onmessage){opts.onmessage(me,jobj.Content)}}else{fns.ExceptionProcess.Process(jobj.ErrorCode+"\n"+jobj.ErrorMessage,"Net.WS");if(opts.onerror){opts.onerror(me,jobj.ErrorCode,jobj.ErrorMessage)}}}else{if(opts.onmessage){opts.onmessage(me,evt.data)}}}};ws.onerror=function(e){fns.ExceptionProcess.Process(e.message,"Net.WS");if(opts.onerror){opts.onerror(me,"-1",e.message)}};ws.onclose=function(){if(opts.onclose){opts.onclose()}}}catch(e){fns.ExceptionProcess.Process(e,"frame.Net.WS");if(opts.onerror){opts.onerror(me,e.name,e.stack)}}});return me},ResponseDataPreProcess:function(e,o,t,r){var s=JSON.TryParse(o);if(!s)s=o;if(s&&s.ErrorCode!=null){if(s.ErrorCode==""){if(FrameNameSpace.Config.Ajax&&FrameNameSpace.Config.Ajax.successAction){if(FrameNameSpace.Config.Ajax.successAction(e,s)){t(s.Content)}}else{t(s.Content)}}else{if(FrameNameSpace.Config.Ajax&&FrameNameSpace.Config.Ajax.failAction){if(FrameNameSpace.Config.Ajax.failAction(e,s.ErrorCode,s.ErrorMessage)){r({errorCode:s.ErrorCode,errorMsg:s.ErrorMessage})}}else{fns.ExceptionProcess.Process(s.ErrorMessage,"Frame.Net.Ajax");r({errorCode:s.ErrorCode,errorMsg:s.ErrorMessage})}}}else{t(s)}}};function GenPostData(e,o,t){if(o.toLowerCase()=="get"){return null}if(t.toLowerCase().indexOf("json")>=0){return JSON.stringify(e)}else if(t.toLowerCase().indexOf("xml")>=0){return e}else if(t.toLowerCase().indexOf("multipart/form-data")>=0){var r=new FormData;if(typeof e=="object"){for(var s in e){r.append(s,e[s])}}else{r.append("data",e)}return r}else{var n="";if(typeof e=="object"){for(var s in e){n+="&"+s+"="+e[s]}n=n!=""?n.substr(1):""}else{n=e}return n}}function FormatResponseData(e){if(e.responseType.toLowerCase()=="blob"){return e.response}else{return e.response}}})(FrameNameSpace);