!function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:function(e,t,n){e.exports=n(22)},14:function(e,t){e.exports=function(e){function t(e,t){var n={},o=[];return ko.utils.arrayForEach(e.split(""),function(e){var i={l:"left",b:"bottom",r:"right",t:"top"}[e];0===t?n[i]=0:1===t&&o.push(i)}),[n,o.join(" ")][t]}if(e.title=e.title||"提示",e.offset=e.offset||"rb",e.onshow=e.onshow||$.noop,e.close=e.close||$.noop,window.dialog||window.artDialog){var n=document.getElementById("__CornerDialog");n&&n.parentElement.removeChild(n),n=document.createElement("div"),n.setAttribute("id","__CornerDialog"),n.style.position="fixed",$.extend(n.style,t(e.offset,0)),document.body.appendChild(n),window.artDialog?artDialog($.extend(e,{follow:n,initialize:e.onshow,fixed:!0})):dialog($.extend(e,{align:t(e.offset),fixed:!0})).show(n)}else window.layer&&layer.open({content:e.content,success:e.onshow,yes:e.ok,offset:e.offset,title:e.title,fixed:!0,id:e.id,type:1,shade:0})}},22:function(e,t,n){window.utils={},window.dialog&&$.extend(dialog.defaults,{skin:"dialog-custom",okValue:"确定",cancelValue:"取消"}),window.console&&console.log||(window.console={log:function(){throw Array.prototype.join(arguments," ")},error:this.log}),utils.classof=function(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).slice(8,-1).toLowerCase()},utils.isNaN=function(e){return"number"==typeof e&&isNaN(e)},String.prototype.padLeft||(String.prototype.padLeft=function(e,t){var n=this;return new Array(Math.max(0,e-n.length+1)).join(t||" ")+n}),Number.prototype.padLeft=function(e,t){return this.toString().padLeft(e,t||"0")},utils.dialog=function(e){if(e&&"object"!==utils.classof(e))throw TypeError("传入的参数必须为对象");if(e&&e.template&&e.viewModel){var t=document.createElement("div");t.setAttribute("id","DIALOG-VM"),t.setAttribute("data-bind","template:__DIALOG_TPL");var n="function"===utils.classof(e.viewModel)?new e.viewModel:e.viewModel;n.__DIALOG_TPL=e.template,n.onclose&&(e.onclose=function(){n.onclose()}),ko.applyBindings(n,t)}var o=ko.utils.extend({},e);return o.id=o.id||"DIALOG-VM",o.skin=o.skin||"dialog-custom",o.content=t,o.onremove=function(){t&&document.body.removeChild(t),e.onremove&&e.onremove.call(this)},dialog(o)},utils.confirm=function(e,t,n,o){var i=dialog.get("DIALOG-CONFIRM");i&&i.remove(),dialog($.extend(o||{},{id:"DIALOG-CONFIRM",title:"操作提示",skin:"dialog-custom",content:e,width:240,ok:void 0===t?$.noop:t,cancel:void 0===n?$.noop:n})).showModal()},window.ko&&(ko.INTERVAL={},ko.extenders.numeric=function(e,t){return e.subscribe(function(n){if(newValue=String(n),newValue.indexOf("e+")>-1&&!utils.isNaN(n))return e(n);t+="";var o=Math.abs(t),i="-"===t.charAt(0),r="-"===newValue.charAt(0)?"-":"";if(0===o){var a=newValue.replace(/[^\d]/g,"");return e((i?r:"")+a)}newValue=newValue.replace(/-/g,"");var s=newValue.indexOf(".");if(0===s)e("");else{var a=newValue.replace(/[^\d]/g,""),l=a.split("");if(s>0){l.splice(s,0,".");var u=s+1+o;u<l.length&&(l.length=u)}e((i?r:"")+l.join(""))}}),e},ko.bindingHandlers.hover={update:function(e,t,n,o,i){var r=$(e),a=r.data(),s={tip:""},l=t(),u=a.align,c=a.delay||0;r.off("mouseenter mouseleave").on({mouseenter:function(t){ko.INTERVAL.bindingHandlers_hover=setTimeout(function(){var n=$.isFunction(l)?l(i.$data):l,o=utils.classof(n),r="string"===o,a="object"===o&&(n instanceof jQuery||/html/.test(o)),c="object"===o&&n.name;if(c){var d=document.createElement("div");d.setAttribute("id","HOVER-VM"),d.setAttribute("data-bind","template:__HOVER_TPL"),n.viewModel.__HOVER_TPL=n.name,ko.applyBindings(n.viewModel,d)}s.tip=dialog({id:"HOVER-TIP",skin:"hover-tips",padding:10,align:u,content:function(){return r?'<div class="break-wrod">'+n+"</div>":a?n:c?d:void 0}(),onshow:function(){if(!u){var e=this.__popup.width();document.documentElement.offsetWidth<t.pageX+e?this.__popup.css("left",document.documentElement.offsetWidth-e-5+"px"):this.__popup.css("left",t.pageX+"px")}},onremove:function(){d&&document.body.removeChild(d)}}).show(e)},c)},mouseleave:function(){clearTimeout(ko.INTERVAL.bindingHandlers_hover),s.tip&&s.tip.remove()}})}},ko.bindingHandlers.slideDown={init:function(e,t){function n(e){e.stopPropagation();var n=$(this).children("[data-slide=body]");n.slideDown(300,function(){n.delegate("[data-value]","click",function(){var e=$(this),r=e.data("value");i.find("[data-slide=bar]").text(e.text()),t()(r),o(n)}),n.on("click",function(e){e.stopPropagation()}),$(document).on("click.slideDown",function(e){o(n)})})}function o(e){$(document).off("click.slideDown"),e.slideUp(100,function(){i.one("click",n)}),e.off("click")}var i=$(e);i.one("click",n)}},ko.bindingHandlers.countdown={update:function(e,t,n,o,i){function r(e){var t=Math.floor(e/3600),n=Math.floor(e%3600/60),o=e%60,i=t>9?t:"0"+t,r=n>9?n:"0"+n,a=o>9?o:"0"+o;return s.replace("hh",i).replace("MM",r).replace("ss",a).replace("h",t).replace("M",n).replace("s",o)}var a=t();ko.isObservable(a)&&(a=a());var s=a.format||"hh:MM:ss";return clearInterval(ko.INTERVAL.bindingHandlers_countdown),"string"==typeof a.rest?void(e.innerHTML=a.rest):a.rest-0<=0?void(e.innerHTML=s.replace(/(hh)|(MM)|(ss)/g,"00").replace(/[hMs]/g,"0")):void("number"==typeof a.rest&&a.rest>0&&(e.innerHTML=r(a.rest),ko.INTERVAL.bindingHandlers_countdown=setInterval(function(){a.rest<1?(clearInterval(ko.INTERVAL.bindingHandlers_countdown),a.callback&&a.callback(o)):e.innerHTML=r(--a.rest)},1e3)))}},ko.bindingHandlers.flip={update:function(e,t,n,o,i){var r=$(e);r.removeClass("flip"),e.innerHTML="",ko.utils.arrayForEach(t()(),function(t,n){var o=document.createElement("span");o.className="lottery-result-ball ball_"+t,o.innerHTML=t.padLeft(CONFIG.numberLen,"0"),e.appendChild(o)}),setTimeout(function(){r.addClass("flip")},100)}},ko.bindingHandlers.swfReadFile={init:function(e,t){var n=t(),o=window.FileReader&&window.File&&window.FileList&&window.Promise,i=$(e).find("object")[0],r=arguments[3].ROOT.textarea,a="fileReader",s="";s=o?'<input type="file" accept="text/plain" class="file-input" style="width: 184px;border: 1px solid;height: 38px;margin: -5px 0 0 -10px;opacity: 0;" id="'+a+'"/>':'<object type="application/x-shockwave-flash" data="'+n+'" width="165" height="30" id="ReadFileSwf"><param name="allowScriptAccess" value="always" /><param name="scale" value="Exactfit" /><param name="quality" value="high"><param name="wmode" value="transparent"><param name="movie" value="'+n+'"></object>',$(e).html(s),o?$(e).on("change",function(){var e=document.getElementById(a).files[0];e.type.includes("text")?utils.readAsText(e).then(function(e){r(e)}):utils.tip("请选择文本文件")}):$(e).on("click",function(){i.fileBrowser()})}}),utils.tip=function(e,t,n,o){3===arguments.length&&"function"==typeof n&&(o=n,n=0),clearTimeout(dialog.timeout),"boolean"==typeof t&&(t=t?"succeed":"defalut");var i=dialog.get("DIALOG-TIP");i&&i.remove();var r=dialog({id:"DIALOG-TIP",title:"操作提示",padding:"30px",content:'<span class="'+t+'">'+e+"</span>",ok:o||$.noop}).showModal();return n&&(dialog.timeout=setTimeout(function(){r.close().remove()},n)),r},$.fn.drag=function(e,t){if(this.length<=0)return this;1===arguments.length&&"function"==typeof e&&(t=e,e=null);var n,o,i=this[0];return e=e?e.toString().toLowerCase():"","x"!==e&&"y"!==e?(n=!0,o=!0):(n="x"===e,o="y"===e),i.onmousedown=function(e){var r=0,a=0,s=e||event;r=s.clientX-i.offsetLeft,a=s.clientY-i.offsetTop;var l=t?function(e){var e=e||event;e.startX=r,e.startY=a,e.dom=i,t(e)}:function(e){var t=e||event;if(n){var s=t.clientX-r;s<0&&(s=0);var l=document.documentElement.clientWidth-i.offsetWidth;s>l&&(s=l),i.style.left=s+"px"}if(o){var u=t.clientY-a;u<0&&(u=0);var c=document.documentElement.clientHeight-i.offsetHeight;u>c&&(u=c),i.style.top=u+"px"}};return i.setCapture?(i.onmousemove=l,i.onmouseup=function(){i.onmousemove=null,i.onmouseup=null,i.releaseCapture()},i.setCapture()):(document.onmousemove=l,document.onmouseup=function(){document.onmousemove=null,document.onmouseup=null}),!1},this},utils.numRangeToArray=function(e){var t=e.match(/\d+/g)||[];if(2!==t.length)throw"输入的参数不正确，参数必须是两个数字有非数字分隔开，如：【1,2】【0-4】";for(var n=t[0],o=t[1],i=[],r=n;r<=o;r++)i.push(r);return i},utils.indexToPos=function(e){switch(e-0){case 0:return"个位";case 1:return"十位";case 2:return"百位";case 3:return"千位";case 4:return"万位";default:return""}},utils.posToIndex=function(e){e=e.replace(/[^万千百十个]+/g,""),e=e.replace("个",0).replace("十",1).replace("百",2).replace("千",3).replace("万",4);var t=e.split("");return t.sort(function(e,t){return e-t>0?-1:1}),t.join("")},utils.map=function(e,t){return Array.prototype.map?e.map(t):ko.utils.arrayMap(e,t)},utils.sort=function(e,t){return t=void 0===t?1:t-0,e.sort(function(e,n){return e-n>0?t:-t}),e},utils.arr2dToString=function(e,t,n){for(var o=[],i=0,r=e.length;i<r;i++)o.push(e[i].join(t));return o.join(n)},utils.stringFilterMulti=function(e){var t={};if(e=String(e),ko.utils.arrayForEach(e.split(""),function(e){t[e]=""}),Object.keys)return Object.keys(t).join("");var n="";for(var o in t)n+=o;return n},utils.random=function(e){return $.isArray(e)?Math.floor(Math.random()*(e[1]+1-e[0])+e[0]):Math.floor(10*Math.random())},utils.cookie={get:function(e){var e=e.replace(".","\\."),t=new RegExp(" "+e+"=[\\S^;]*","g"),n=(" "+document.cookie+";").match(t);return null===n?null:decodeURIComponent(n[0].replace(/^.*=/,"").slice(0,-1))},set:function(e,t,n,o,i,r){var a=new Date;a.setTime(a.getTime()),n&&(n=1e3*n*60*60*24);var s=new Date(a.getTime()+n);document.cookie=e+"="+escape(t)+(n?";expires="+s.toGMTString():"")+(o?";path="+o:"")+(i?";domain="+i:"")+(r?";secure":"")},remove:function(e,t,n){this.get(e)&&(document.cookie=e+"="+(t?";path="+t:"")+(n?";domain="+n:"")+";expires=Thu,01-Jan-1970 00:00:01 GMT")}},utils.localStore=function(e,t,n){return t?void(window.localStorage?localStorage.setItem(e,t):utils.cookie.set(e,vlaue,365,n||"/")):window.localStorage?localStorage.getItem(e):utils.cookie.get(e)},utils.sound={ext:".mp3",name:"1",create:function(e){this.path=e.path,this.name=e.filename||this.name;var t=e.path+this.name,n=this.times=e.times||5;if(/msie/i.test(navigator.userAgent)&&parseInt(navigator.userAgent.match(/msie.([\d\.]+)/i)[1],10)<9){this.modern=2;var o=this.ele=document.createElement("bgsound");o.setAttribute("src","#"),o.setAttribute("id","BGSound"),o.setAttribute("loop",n),document.body.appendChild(o)}else if(/version.+safari/i.test(navigator.userAgent)){this.modern=3,this.ext=".swf";var i=this.ele=document.createElement("embed");i.setAttribute("src",t+this.ext),i.setAttribute("id","BGSound"),i.style.position="fixed",i.style.top="-10px",i.setAttribute("height","0"),i.style.visibility="hidden",document.body.appendChild(i)}else{this.modern=1,this.ext=/trident/i.test(navigator.userAgent)?".mp3":".ogg";var r=this.ele=document.createElement("audio");if(this.name-0<0)return;r.setAttribute("src",t+this.ext)}},play:function(){var e=this;if(1===e.modern){var t=1;e.ele.addEventListener("ended",function(){t<e.times&&(++t,e.ele.play())}),e.ele.play()}else 2===e.modern?e.ele.src=e.filename+"?_="+(new Date-0):3===e.modern&&e.ele.soundPlay(e.times)},play2:function(e){if(e-0<0)return this.name="-1",void(this.ele.src="#");if(!(void 0===e&&this.name-0<0)){this.name=e||this.name;var t=this.path+this.name+this.ext+"?_="+(new Date-0);switch(this.modern){case 1:this.ele.src=t,this.ele.play();break;case 2:this.ele.src=t;break;case 3:this.ele.src=t,this.ele.soundPlay(1)}}}},utils.async=function(e,t,n){return"[object Array]"!==Object.prototype.toString.call(e)?n(new Error("第一个参数必须为数组")):0===e.length?n(null):(function o(i){return i>=e.length?n(null):void t(e[i],function(){o(++i)})}(0),function(){e.length=0})},Date.prototype.format=function(e){function t(e){return e<10?"0"+e:e}e=e||"yyyy/MM/dd hh:mm:ss";var n=this.getFullYear(),o=this.getMonth()+1,i=this.getDate(),r=this.getHours(),a=this.getMinutes(),s=this.getSeconds(),l=this.getDay()||7,u=["一","二","三","四","五","六","日"][l-1];return e.replace(/y+/,n).replace(/M{2,}/,t(o)).replace(/d{2,}/,t(i)).replace("M",o).replace("d",i).replace(/h{2,}/,t(r)).replace(/m{2,}/,t(a)).replace(/s{2,}/,t(s)).replace("h",r).replace("m",a).replace("s",s).replace("w",l).replace("W",u)},utils.toObservable=function(e){function t(e){for(var t in e)e[t]=ko.observable(e[t]);return e}function n(e){for(var o=e(),i=0;i<o.length;i++){var r=utils.classof(o[i]);"array"===r?(o[i]=ko.observableArray(o[i]),n(o[i]())):"object"===r?t(o[i]):o[i]=ko.observable(o[i])}}if(!window.ko)return e;var o=utils.classof(e);return"object"===o?t(e):"array"===o&&(e=ko.observableArray(e),n(e)),e},utils.toFixed=function(e,t){return t=void 0===t?9:t,(e-0).toFixed(t)-0},utils.numInArrRange=function(e,t){return e>=t[0]&&e<=t[1]},$.fn.textScroller=function(e,t){function n(t,n){function i(e){var t=(new Date,null);m.stop().animate(g[s],e,"linear",function(){m.css(s,c+"px"),i(p)}).off().on({mouseenter:function(){$(this).stop()},mouseleave:function(){var e=$(this);clearTimeout(t),t=setTimeout(function(){var t=(h+(e.css(s).replace(/[^\d\.\-]/g,"")-0))/n*(1e3*o.speed);i(t)},200)}})}if(""!==t.html().replace(/\s/g,"")){t.show(),n=n?Number(n):30,1===t.data("ts")&&(t.children().stop().off(),t.html(e||t.children().children().html())),t.data("ts",1);var r=(t.width(),t.height(),document.createElement("div")),a=document.createElement("div"),s=t.data("direction");s=/^(top)|(left)$/i.test(s)?s.toLocaleLowerCase():"left";var l={left:"width",top:"height"},u=t[l[s]](),c=void 0===o.start?u:o.start;r.style.width="100%",r.style.height="100%",r.style.position="relative",r.style.overflow="hidden";var d;"left"===s?d={position:"absolute",left:c+"px",top:"0px",whiteSpace:"nowrap"}:"top"===s&&(d={position:"absolute",top:c+"px"});for(var f in d)a.style[f]=d[f];a.innerHTML=o.smooth?t.html()+t.html():t.html(),r.appendChild(a),t.html(r);var p,m=$(a),h=o.smooth?m[l[s]]()/2:m[l[s]]();if(h<1)return this;h=h>c?h:c,p=(h+c)/n*(1e3*o.speed),t.children().children();var g={left:{left:-h+"px"},top:{top:-h+"px"}};i(p)}}var o={speed:1,start:void 0,smooth:!1};return 0===this.length?this:($.extend(o,t),this.each(function(){n($(this),$(this).data("speed"))}),this)},utils.readAsText=function(e){return new Promise(function(t,n){var o=new FileReader;o.readAsText(e),o.onload=function(e){t(this.result)}})},$.fn.textColorSwitch=function(e,t){function n(){(!t||t<0||a<t)&&($.each(r,function(e,t){t.lens>0&&(t.ele.css("color",t.colors[t.cur]),t.cur=(t.cur+1)%t.lens)}),setTimeout(n,e)),a++}var o=$(this);e=e||500;var i=$("[data-color]",o),r=$.map(i,function(e){var t=$(e).attr("data-color").split(",");return{ele:$(e),colors:t,lens:t.length,cur:0}}),a=0;n()},utils.arrSortByKey=function(e,t,n){function o(t){for(var o=e.length,i=0;i<o-1;i++)for(var r=0;r<o-1-i;r++)if(n&&e[r][t]<e[r+1][t]||!n&&e[r][t]>e[r+1][t]){var a=e[r];e[r]=e[r+1],e[r+1]=a}}"string"==typeof t&&(t=[t]);for(var i=t.length,r=0;r<i;r++)o(t[r]);return e},utils.cornerDialog=n(14),utils.unreadMessages=n(23)},23:function(e,t){function n(e){for(var t={status:!1,count:0},n=0;n<e.length;n++)if(2==e[n].Type){t.status=!0,t.count=e[n].Count;break}t.status?($("#msg_info, #show_msg").removeClass("dn"),function(e,t){var n="redm";e.indexOf("MSIE")!==-1&&~~e.substr(e.indexOf("MSIE")+5,3)<9&&(n=t<10?"redm":t>9&&t<100?"red":"redbg",$("#msg_info").css({background:"url("+(window.iis||"")+"/Content/default/home/images/usercenter/"+n+".png) no-repeat scroll 0 0 transparent;background-size:100% 100%;"}))}(navigator.userAgent,t.count),t.count?t.count&&t.count<100?txt=t.count:txt="99+":$("#msg_info, #show_msg").addClass("dn"),t.count?$("#JHasMessage").addClass("mail-box-h"):$("#JHasMessage").removeClass("mail-box-h"),$("#msg_info, #show_msg").text(txt)):($("#msg_info, #show_msg").addClass("dn"),$("#JHasMessage").removeClass("mail-box-h"))}function o(e,t){for(var n=i(),o="",a=e.length,u=0;u<a;u++){var c=e[u],d=n[c.Type]||0;d<c.FId&&(o+='<p class="content">您有未读的<a href="'+s[c.Type]+'" target="_blank">'+l[c.Type]+"</a></p>",n[c.Type]=c.FId)}o&&(o='<div class="message-container">'+o,o+="</div>",t&&utils.cornerDialog({id:"immediateMessageDialog",content:o}),r(n))}function i(){var e=[],t=u.getItem("immediateMessageCookie")||"";t=t.split("|");for(var n=0;n<t.length;n++){var o=t[n].split(",");2===o.length&&(e[o[0]-0]=o[1]-0)}return e}function r(e){for(var t="",n=0,o=0;o<e.length;o++)e[o]&&(n>0&&(t+="|"),t+=""+o+","+e[o],n++);u.setItem("immediateMessageCookie",t)}function a(e){function t(){l&&clearInterval(l),utils&&utils.cookie&&utils.cookie.get("LoginSessionID")&&$.ajax({url:"/Home/QueryMessage",type:"get",dataType:"",cache:!1,success:function(e){s&&n(e),o(e,!a||a&&u>0),r(e),u++,l=setTimeout(t,i)}})}var i=e&&e.timeout||3e4,r=e&&e.callback||function(){},a=e&&e.hasPopDialogTip,s=e&&e.needUndreadHandle,l=0,u=0;t()}var s=["","/UserCenter/Notice","/UserCenter/Messge"],l=["","公告","站内信"],u=window.localStorage?localStorage:{getItem:function(e){return utils.cookie.get(e)},setItem:function(e,t){return utils.cookie.set(e,t,0,"/")}};a.setMessageCookie=r,a.getMessageCookie=i,e.exports=a}});
//# sourceMappingURL=http://dev.me/official/utils.min.js.map