/*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c; }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,la=/\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;if(t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),"number"==typeof a.focusBtn){n.find("."+l[6]).children("a").each(function(){var e=i(this),t=i("', closeClass: 'toast-close-button', newestOnTop: true, preventDuplicates: false, progressBar: false, progressClass: 'toast-progress', rtl: false }; } function publish(args) { if (!listener) { return; } listener(args); } function notify(map) { var options = getOptions(); var iconClass = map.iconClass || options.iconClass; if (typeof (map.optionsOverride) !== 'undefined') { options = $.extend(options, map.optionsOverride); iconClass = map.optionsOverride.iconClass || iconClass; } if (shouldExit(options, map)) { return; } toastId++; $container = getContainer(options, true); var intervalId = null; var $toastElement = $('
'); var $titleElement = $('
'); var $messageElement = $('
'); var $progressElement = $('
'); var $closeElement = $(options.closeHtml); var progressBar = { intervalId: null, hideEta: null, maxHideTime: null }; var response = { toastId: toastId, state: 'visible', startTime: new Date(), options: options, map: map }; personalizeToast(); displayToast(); handleEvents(); publish(response); if (options.debug && console) { console.log(response); } return $toastElement; function escapeHtml(source) { if (source == null) { source = ''; } return source .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(//g, '>'); } function personalizeToast() { setIcon(); setTitle(); setMessage(); setCloseButton(); setProgressBar(); setRTL(); setSequence(); setAria(); } function setAria() { var ariaValue = ''; switch (map.iconClass) { case 'toast-success': case 'toast-info': ariaValue = 'polite'; break; default: ariaValue = 'assertive'; } $toastElement.attr('aria-live', ariaValue); } function handleEvents() { if (options.closeOnHover) { $toastElement.hover(stickAround, delayedHideToast); } if (!options.onclick && options.tapToDismiss) { $toastElement.click(hideToast); } if (options.closeButton && $closeElement) { $closeElement.click(function (event) { if (event.stopPropagation) { event.stopPropagation(); } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) { event.cancelBubble = true; } if (options.onCloseClick) { options.onCloseClick(event); } hideToast(true); }); } if (options.onclick) { $toastElement.click(function (event) { options.onclick(event); hideToast(); }); } } function displayToast() { $toastElement.hide(); $toastElement[options.showMethod]( {duration: options.showDuration, easing: options.showEasing, complete: options.onShown} ); if (options.timeOut > 0) { intervalId = setTimeout(hideToast, options.timeOut); progressBar.maxHideTime = parseFloat(options.timeOut); progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; if (options.progressBar) { progressBar.intervalId = setInterval(updateProgress, 10); } } } function setIcon() { if (map.iconClass) { $toastElement.addClass(options.toastClass).addClass(iconClass); } } function setSequence() { if (options.newestOnTop) { $container.prepend($toastElement); } else { $container.append($toastElement); } } function setTitle() { if (map.title) { var suffix = map.title; if (options.escapeHtml) { suffix = escapeHtml(map.title); } $titleElement.append(suffix).addClass(options.titleClass); $toastElement.append($titleElement); } } function setMessage() { if (map.message) { var suffix = map.message; if (options.escapeHtml) { suffix = escapeHtml(map.message); } $messageElement.append(suffix).addClass(options.messageClass); $toastElement.append($messageElement); } } function setCloseButton() { if (options.closeButton) { $closeElement.addClass(options.closeClass).attr('role', 'button'); $toastElement.prepend($closeElement); } } function setProgressBar() { if (options.progressBar) { $progressElement.addClass(options.progressClass); $toastElement.prepend($progressElement); } } function setRTL() { if (options.rtl) { $toastElement.addClass('rtl'); } } function shouldExit(options, map) { if (options.preventDuplicates) { if (map.message === previousToast) { return true; } else { previousToast = map.message; } } return false; } function hideToast(override) { var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod; var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration; var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing; if ($(':focus', $toastElement).length && !override) { return; } clearTimeout(progressBar.intervalId); return $toastElement[method]({ duration: duration, easing: easing, complete: function () { removeToast($toastElement); clearTimeout(intervalId); if (options.onHidden && response.state !== 'hidden') { options.onHidden(); } response.state = 'hidden'; response.endTime = new Date(); publish(response); } }); } function delayedHideToast() { if (options.timeOut > 0 || options.extendedTimeOut > 0) { intervalId = setTimeout(hideToast, options.extendedTimeOut); progressBar.maxHideTime = parseFloat(options.extendedTimeOut); progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; } } function stickAround() { clearTimeout(intervalId); progressBar.hideEta = 0; $toastElement.stop(true, true)[options.showMethod]( {duration: options.showDuration, easing: options.showEasing} ); } function updateProgress() { var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100; $progressElement.width(percentage + '%'); } } function getOptions() { return $.extend({}, getDefaults(), toastr.options); } function removeToast($toastElement) { if (!$container) { $container = getContainer(); } if ($toastElement.is(':visible')) { return; } $toastElement.remove(); $toastElement = null; if ($container.children().length === 0) { $container.remove(); previousToast = undefined; } } })(); }); }(typeof define === 'function' && define.amd ? define : function (deps, factory) { if (typeof module !== 'undefined' && module.exports) { //Node module.exports = factory(require('jquery')); } else { window.toastr = factory(window.jQuery); } })); define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { var Fast = { config: { //toastr默认配置 toastr: { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass": "toast-top-center", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } }, events: { //请求成功的回调 onAjaxSuccess: function (ret, onAjaxSuccess) { var data = typeof ret.data !== 'undefined' ? ret.data : null; var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed'); if (typeof onAjaxSuccess === 'function') { var result = onAjaxSuccess.call(this, data, ret); if (result === false) return; } Toastr.success(msg); }, //请求错误的回调 onAjaxError: function (ret, onAjaxError) { var data = typeof ret.data !== 'undefined' ? ret.data : null; if (typeof onAjaxError === 'function') { var result = onAjaxError.call(this, data, ret); if (result === false) { return; } } Toastr.error(ret.msg); }, //服务器响应数据后 onAjaxResponse: function (response) { try { var ret = typeof response === 'object' ? response : JSON.parse(response); if (!ret.hasOwnProperty('code')) { $.extend(ret, {code: -2, msg: response, data: null}); } } catch (e) { var ret = {code: -1, msg: e.message, data: null}; } return ret; } }, api: { //发送Ajax请求 ajax: function (options, success, error) { options = typeof options === 'string' ? {url: options} : options; var index; if (typeof options.loading === 'undefined' || options.loading) { index = Layer.load(options.loading || 0); } options = $.extend({ type: "POST", dataType: "json", xhrFields: { withCredentials: true }, success: function (ret) { index && Layer.close(index); ret = Fast.events.onAjaxResponse(ret); if (ret.code === 1) { Fast.events.onAjaxSuccess(ret, success); } else { Fast.events.onAjaxError(ret, error); } }, error: function (xhr) { index && Layer.close(index); var ret = {code: xhr.status, msg: xhr.statusText, data: null}; Fast.events.onAjaxError(ret, error); } }, options); return $.ajax(options); }, //修复URL fixurl: function (url) { if (url.substr(0, 1) !== "/") { var r = new RegExp('^(?:[a-z]+:)?//', 'i'); if (!r.test(url)) { url = Config.moduleurl + "/" + url; } } else if (url.substr(0, 8) === "/addons/") { url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url; } return url; }, //获取修复后可访问的cdn链接 cdnurl: function (url, domain) { var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i"); var cdnurl = Config.upload.cdnurl; url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url; if (domain && !rule.test(url)) { domain = typeof domain === 'string' ? domain : location.origin; url = domain + url; } return url; }, //查询Url参数 query: function (name, url) { if (!url) { url = window.location.href; } name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); }, //打开一个弹出窗口 open: function (url, title, options) { title = options && options.title ? options.title : (title ? title : ""); url = Fast.api.fixurl(url); url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1"; var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%']; options = $.extend({ type: 2, title: title, shadeClose: true, shade: false, maxmin: true, moveOut: true, area: area, content: url, zIndex: Layer.zIndex, success: function (layero, index) { var that = this; //存储callback事件 $(layero).data("callback", that.callback); //$(layero).removeClass("layui-layer-border"); Layer.setTop(layero); try { var frame = Layer.getChildFrame('html', index); var layerfooter = frame.find(".layer-footer"); Fast.api.layerfooter(layero, index, that); //绑定事件 if (layerfooter.length > 0) { // 监听窗口内的元素及属性变化 // Firefox和Chrome早期版本中带有前缀 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; if (MutationObserver) { // 选择目标节点 var target = layerfooter[0]; // 创建观察者对象 var observer = new MutationObserver(function (mutations) { Fast.api.layerfooter(layero, index, that); mutations.forEach(function (mutation) { }); }); // 配置观察选项: var config = {attributes: true, childList: true, characterData: true, subtree: true} // 传入目标节点和观察选项 observer.observe(target, config); // 随后,你还可以停止观察 // observer.disconnect(); } } } catch (e) { } if ($(layero).height() > $(window).height()) { //当弹出窗口大于浏览器可视高度时,重定位 Layer.style(index, { top: 0, height: $(window).height() }); } } }, options ? options : {}); if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) { if (top.$(".tab-pane.active").length > 0) { options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"]; options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"]; } else { options.area = [$(window).width() + "px", $(window).height() + "px"]; options.offset = ["0px", "0px"]; } } return Layer.open(options); }, //关闭窗口并回传数据 close: function (data) { var index = parent.Layer.getFrameIndex(window.name); var callback = parent.$("#layui-layer" + index).data("callback"); //再执行关闭 parent.Layer.close(index); //再调用回传函数 if (typeof callback === 'function') { callback.call(undefined, data); } }, layerfooter: function (layero, index, that) { var frame = Layer.getChildFrame('html', index); var layerfooter = frame.find(".layer-footer"); if (layerfooter.length > 0) { $(".layui-layer-footer", layero).remove(); var footer = $("
").addClass('layui-layer-btn layui-layer-footer'); footer.html(layerfooter.html()); if ($(".row", footer).length === 0) { $(">", footer).wrapAll("
"); } footer.insertAfter(layero.find('.layui-layer-content')); //绑定事件 footer.on("click", ".btn", function () { if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) { return; } var index = footer.find('.btn').index(this); $(".btn:eq(" + index + ")", layerfooter).trigger("click"); }); var titHeight = layero.find('.layui-layer-title').outerHeight() || 0; var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0; //重设iframe高度 $("iframe", layero).height(layero.height() - titHeight - btnHeight); } //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) { var titHeight = layero.find('.layui-layer-title').outerHeight() || 0; var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0; $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight); $("iframe", layero).css("height", "100%"); } }, success: function (options, callback) { var type = typeof options === 'function'; if (type) { callback = options; } return Layer.msg(__('Operation completed'), $.extend({ offset: 0, icon: 1 }, type ? {} : options), callback); }, error: function (options, callback) { var type = typeof options === 'function'; if (type) { callback = options; } return Layer.msg(__('Operation failed'), $.extend({ offset: 0, icon: 2 }, type ? {} : options), callback); }, msg: function (message, url) { var callback = typeof url === 'function' ? url : function () { if (typeof url !== 'undefined' && url) { location.href = url; } }; Layer.msg(message, { time: 2000 }, callback); }, toastr: Toastr, layer: Layer }, lang: function () { var args = arguments, string = args[0], i = 1; string = string.toLowerCase(); //string = typeof Lang[string] != 'undefined' ? Lang[string] : string; if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') { if (typeof Lang[string] == 'object') return Lang[string]; string = Lang[string]; } else if (string.indexOf('.') !== -1 && false) { var arr = string.split('.'); var current = Lang[arr[0]]; for (var i = 1; i < arr.length; i++) { current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : ''; if (typeof current != 'object') break; } if (typeof current == 'object') return current; string = current; } else { string = args[0]; } return string.replace(/%((%)|s|d)/g, function (m) { // m is the matched format, e.g. %s, %d var val = null; if (m[2]) { val = m[2]; } else { val = args[i]; // A switch statement so that the formatter can be extended. Default is %s switch (m) { case '%d': val = parseFloat(val); if (isNaN(val)) { val = 0; } break; } i++; } return val; }); }, init: function () { // 对相对地址进行处理 $.ajaxSetup({ beforeSend: function (xhr, setting) { setting.url = Fast.api.fixurl(setting.url); } }); Layer.config({ skin: 'layui-layer-fast' }); // 绑定ESC关闭窗口事件 $(window).keyup(function (e) { if (e.keyCode == 27) { if ($(".layui-layer").length > 0) { var index = 0; $(".layui-layer").each(function () { index = Math.max(index, parseInt($(this).attr("times"))); }); if (index) { Layer.close(index); } } } }); //公共代码 //配置Toastr的参数 Toastr.options = Fast.config.toastr; } }; //将Layer暴露到全局中去 window.Layer = Layer; //将Toastr暴露到全局中去 window.Toastr = Toastr; //将语言方法暴露到全局中去 window.__ = Fast.lang; //将Fast渲染至全局 window.Fast = Fast; //默认初始化执行的代码 Fast.init(); return Fast; }); /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/ !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(//g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"<",">":">",'"':""","'":"'","&":"&"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}(); //! moment.js //! version : 2.29.4 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define('moment/moment',factory) : global.moment = factory() }(this, (function () { 'use strict'; var hookCallback; function hooks() { return hookCallback.apply(null, arguments); } // This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback(callback) { hookCallback = callback; } function isArray(input) { return ( input instanceof Array || Object.prototype.toString.call(input) === '[object Array]' ); } function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return ( input != null && Object.prototype.toString.call(input) === '[object Object]' ); } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return Object.getOwnPropertyNames(obj).length === 0; } else { var k; for (k in obj) { if (hasOwnProp(obj, k)) { return false; } } return true; } } function isUndefined(input) { return input === void 0; } function isNumber(input) { return ( typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]' ); } function isDate(input) { return ( input instanceof Date || Object.prototype.toString.call(input) === '[object Date]' ); } function map(arr, fn) { var res = [], i, arrLen = arr.length; for (i = 0; i < arrLen; ++i) { res.push(fn(arr[i], i)); } return res; } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, 'toString')) { a.toString = b.toString; } if (hasOwnProp(b, 'valueOf')) { a.valueOf = b.valueOf; } return a; } function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); } function defaultParsingFlags() { // We need to deep clone this object. return { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false, }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function (fun) { var t = Object(this), len = t.length >>> 0, i; for (i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m), parsedParts = some.call(flags.parsedDateParts, function (i) { return i != null; }), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || (flags.meridiem && parsedParts)); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } } return m._isValid; } function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. var momentProperties = (hooks.momentProperties = []), updateInProgress = false; function copyConfig(to, from) { var i, prop, val, momentPropertiesLen = momentProperties.length; if (!isUndefined(from._isAMomentObject)) { to._isAMomentObject = from._isAMomentObject; } if (!isUndefined(from._i)) { to._i = from._i; } if (!isUndefined(from._f)) { to._f = from._f; } if (!isUndefined(from._l)) { to._l = from._l; } if (!isUndefined(from._strict)) { to._strict = from._strict; } if (!isUndefined(from._tzm)) { to._tzm = from._tzm; } if (!isUndefined(from._isUTC)) { to._isUTC = from._isUTC; } if (!isUndefined(from._offset)) { to._offset = from._offset; } if (!isUndefined(from._pf)) { to._pf = getParsingFlags(from); } if (!isUndefined(from._locale)) { to._locale = from._locale; } if (momentPropertiesLen > 0) { for (i = 0; i < momentPropertiesLen; i++) { prop = momentProperties[i]; val = from[prop]; if (!isUndefined(val)) { to[prop] = val; } } } return to; } // Moment prototype object function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment(obj) { return ( obj instanceof Moment || (obj != null && obj._isAMomentObject != null) ); } function warn(msg) { if ( hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn ) { console.warn('Deprecation warning: ' + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = [], arg, i, key, argLen = arguments.length; for (i = 0; i < argLen; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (key in arguments[0]) { if (hasOwnProp(arguments[0], key)) { arg += key + ': ' + arguments[0][key] + ', '; } } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn( msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack ); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return ( (typeof Function !== 'undefined' && input instanceof Function) || Object.prototype.toString.call(input) === '[object Function]' ); } function set(config) { var prop, i; for (i in config) { if (hasOwnProp(config, i)) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this['_' + i] = prop; } } } this._config = config; // Lenient ordinal parsing accepts just a number in addition to // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. // TODO: Remove "ordinalParse" fallback in next major release. this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source ); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if ( hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop]) ) { // make sure changes to properties don't modify parent config res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function (obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var defaultCalendar = { sameDay: '[Today at] LT', nextDay: '[Tomorrow at] LT', nextWeek: 'dddd [at] LT', lastDay: '[Yesterday at] LT', lastWeek: '[Last] dddd [at] LT', sameElse: 'L', }; function calendar(key, mom, now) { var output = this._calendar[key] || this._calendar['sameElse']; return isFunction(output) ? output.call(mom, now) : output; } function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return ( (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber ); } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; // token: 'M' // padded: ['MM', 2] // ordinal: 'Mo' // callback: function () { this.month() + 1 } function addFormatToken(token, padded, ordinal, callback) { var func = callback; if (typeof callback === 'string') { func = function () { return this[callback](); }; } if (token) { formatTokenFunctions[token] = func; } if (padded) { formatTokenFunctions[padded[0]] = function () { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal) { formatTokenFunctions[ordinal] = function () { return this.localeData().ordinal( func.apply(this, arguments), token ); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ''); } return input.replace(/\\/g, ''); } function makeFormatFunction(format) { var array = format.match(formattingTokens), i, length; for (i = 0, length = array.length; i < length; i++) { if (formatTokenFunctions[array[i]]) { array[i] = formatTokenFunctions[array[i]]; } else { array[i] = removeFormattingTokens(array[i]); } } return function (mom) { var output = '', i; for (i = 0; i < length; i++) { output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } return output; }; } // format date using native date object function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); } function expandFormat(format, locale) { var i = 5; function replaceLongDateFormatTokens(input) { return locale.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i >= 0 && localFormattingTokens.test(format)) { format = format.replace( localFormattingTokens, replaceLongDateFormatTokens ); localFormattingTokens.lastIndex = 0; i -= 1; } return format; } var defaultLongDateFormat = { LTS: 'h:mm:ss A', LT: 'h:mm A', L: 'MM/DD/YYYY', LL: 'MMMM D, YYYY', LLL: 'MMMM D, YYYY h:mm A', LLLL: 'dddd, MMMM D, YYYY h:mm A', }; function longDateFormat(key) { var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format || !formatUpper) { return format; } this._longDateFormat[key] = formatUpper .match(formattingTokens) .map(function (tok) { if ( tok === 'MMMM' || tok === 'MM' || tok === 'DD' || tok === 'dddd' ) { return tok.slice(1); } return tok; }) .join(''); return this._longDateFormat[key]; } var defaultInvalidDate = 'Invalid date'; function invalidDate() { return this._invalidDate; } var defaultOrdinal = '%d', defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal(number) { return this._ordinal.replace('%d', number); } var defaultRelativeTime = { future: 'in %s', past: '%s ago', s: 'a few seconds', ss: '%d seconds', m: 'a minute', mm: '%d minutes', h: 'an hour', hh: '%d hours', d: 'a day', dd: '%d days', w: 'a week', ww: '%d weeks', M: 'a month', MM: '%d months', y: 'a year', yy: '%d years', }; function relativeTime(number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture(diff, output) { var format = this._relativeTime[diff > 0 ? 'future' : 'past']; return isFunction(format) ? format(output) : format.replace(/%s/i, output); } var aliases = {}; function addUnitAlias(unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = [], u; for (u in unitsObj) { if (hasOwnProp(unitsObj, u)) { units.push({ unit: u, priority: priorities[u] }); } } units.sort(function (a, b) { return a.priority - b.priority; }); return units; } function isLeapYear(year) { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } function absFloor(number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } function makeGetSet(unit, keepTime) { return function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get(mom, unit) { return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; } function set$1(mom, unit, value) { if (mom.isValid() && !isNaN(value)) { if ( unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29 ) { value = toInt(value); mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( value, mom.month(), daysInMonth(value, mom.month()) ); } else { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); } } } // MOMENTS function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet(units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length; for (i = 0; i < prioritizedLen; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } var match1 = /\d/, // 0 - 9 match2 = /\d\d/, // 00 - 99 match3 = /\d{3}/, // 000 - 999 match4 = /\d{4}/, // 0000 - 9999 match6 = /[+-]?\d{6}/, // -999999 - 999999 match1to2 = /\d\d?/, // 0 - 99 match3to4 = /\d\d\d\d?/, // 999 - 9999 match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 match1to3 = /\d{1,3}/, // 0 - 999 match1to4 = /\d{1,4}/, // 0 - 9999 match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 matchUnsigned = /\d+/, // 0 - inf matchSigned = /[+-]?\d+/, // -inf - inf matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 // any word (or two) characters or numbers including two/three word month in arabic. // includes scottish gaelic two word and hyphenated months matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, regexes; regexes = {}; function addRegexToken(token, regex, strictRegex) { regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { return isStrict && strictRegex ? strictRegex : regex; }; } function getParseRegexForToken(token, config) { if (!hasOwnProp(regexes, token)) { return new RegExp(unescapeFormat(token)); } return regexes[token](config._strict, config._locale); } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function unescapeFormat(s) { return regexEscape( s .replace('\\', '') .replace( /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; } ) ); } function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } var tokens = {}; function addParseToken(token, callback) { var i, func = callback, tokenLen; if (typeof token === 'string') { token = [token]; } if (isNumber(callback)) { func = function (input, array) { array[callback] = toInt(input); }; } tokenLen = token.length; for (i = 0; i < tokenLen; i++) { tokens[token[i]] = func; } } function addWeekParseToken(token, callback) { addParseToken(token, function (input, array, config, token) { config._w = config._w || {}; callback(input, config._w, config, token); }); } function addTimeToArrayFromToken(token, input, config) { if (input != null && hasOwnProp(tokens, token)) { tokens[token](input, config._a, config, token); } } var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8; function mod(n, x) { return ((n % x) + x) % x; } var indexOf; if (Array.prototype.indexOf) { indexOf = Array.prototype.indexOf; } else { indexOf = function (o) { // I know var i; for (i = 0; i < this.length; ++i) { if (this[i] === o) { return i; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - ((modMonth % 7) % 2); } // FORMATTING addFormatToken('M', ['MM', 2], 'Mo', function () { return this.month() + 1; }); addFormatToken('MMM', 0, 0, function (format) { return this.localeData().monthsShort(this, format); }); addFormatToken('MMMM', 0, 0, function (format) { return this.localeData().months(this, format); }); // ALIASES addUnitAlias('month', 'M'); // PRIORITY addUnitPriority('month', 8); // PARSING addRegexToken('M', match1to2); addRegexToken('MM', match1to2, match2); addRegexToken('MMM', function (isStrict, locale) { return locale.monthsShortRegex(isStrict); }); addRegexToken('MMMM', function (isStrict, locale) { return locale.monthsRegex(isStrict); }); addParseToken(['M', 'MM'], function (input, array) { array[MONTH] = toInt(input) - 1; }); addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (month != null) { array[MONTH] = month; } else { getParsingFlags(config).invalidMonth = input; } }); // LOCALES var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( '_' ), defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord; function localeMonths(m, format) { if (!m) { return isArray(this._months) ? this._months : this._months['standalone']; } return isArray(this._months) ? this._months[m.month()] : this._months[ (this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone' ][m.month()]; } function localeMonthsShort(m, format) { if (!m) { return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; } return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[ MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' ][m.month()]; } function handleStrictParse(monthName, format, strict) { var i, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { // this is not used this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i = 0; i < 12; ++i) { mom = createUTC([2000, i]); this._shortMonthsParse[i] = this.monthsShort( mom, '' ).toLocaleLowerCase(); this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse(monthName, format, strict) { var i, mom, regex; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } // TODO: add sorting // Sorting makes sure if one month (or abbr) is a prefix of another // see sorting in computeMonthsParse for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); if (strict && !this._longMonthsParse[i]) { this._longMonthsParse[i] = new RegExp( '^' + this.months(mom, '').replace('.', '') + '$', 'i' ); this._shortMonthsParse[i] = new RegExp( '^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i' ); } if (!strict && !this._monthsParse[i]) { regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName) ) { return i; } else if ( strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName) ) { return i; } else if (!strict && this._monthsParse[i].test(monthName)) { return i; } } } // MOMENTS function setMonth(mom, value) { var dayOfMonth; if (!mom.isValid()) { // No op return mom; } if (typeof value === 'string') { if (/^\d+$/.test(value)) { value = toInt(value); } else { value = mom.localeData().monthsParse(value); // TODO: Another silent failure? if (!isNumber(value)) { return mom; } } } dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); return mom; } function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } } function getDaysInMonth() { return daysInMonth(this.year(), this.month()); } function monthsShortRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, '_monthsShortRegex')) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } function monthsRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, '_monthsRegex')) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse() { function cmpLenRev(a, b) { return b.length - a.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i, mom; for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); shortPieces.push(this.monthsShort(mom, '')); longPieces.push(this.months(mom, '')); mixedPieces.push(this.months(mom, '')); mixedPieces.push(this.monthsShort(mom, '')); } // Sorting makes sure if one month (or abbr) is a prefix of another it // will match the longer piece. shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i = 0; i < 12; i++) { shortPieces[i] = regexEscape(shortPieces[i]); longPieces[i] = regexEscape(longPieces[i]); } for (i = 0; i < 24; i++) { mixedPieces[i] = regexEscape(mixedPieces[i]); } this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._monthsShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); } // FORMATTING addFormatToken('Y', 0, 0, function () { var y = this.year(); return y <= 9999 ? zeroFill(y, 4) : '+' + y; }); addFormatToken(0, ['YY', 2], 0, function () { return this.year() % 100; }); addFormatToken(0, ['YYYY', 4], 0, 'year'); addFormatToken(0, ['YYYYY', 5], 0, 'year'); addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES addUnitAlias('year', 'y'); // PRIORITIES addUnitPriority('year', 1); // PARSING addRegexToken('Y', matchSigned); addRegexToken('YY', match1to2, match2); addRegexToken('YYYY', match1to4, match4); addRegexToken('YYYYY', match1to6, match6); addRegexToken('YYYYYY', match1to6, match6); addParseToken(['YYYYY', 'YYYYYY'], YEAR); addParseToken('YYYY', function (input, array) { array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken('YY', function (input, array) { array[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken('Y', function (input, array) { array[YEAR] = parseInt(input, 10); }); // HELPERS function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } // HOOKS hooks.parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }; // MOMENTS var getSetYear = makeGetSet('FullYear', true); function getIsLeapYear() { return isLeapYear(this.year()); } function createDate(y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 var date; // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset date = new Date(y + 400, m, d, h, M, s, ms); if (isFinite(date.getFullYear())) { date.setFullYear(y); } } else { date = new Date(y, m, d, h, M, s, ms); } return date; } function createUTCDate(y) { var date, args; // the Date.UTC function remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { args = Array.prototype.slice.call(arguments); // preserve leap years using a full 400 year cycle, then reset args[0] = y + 400; date = new Date(Date.UTC.apply(null, args)); if (isFinite(date.getUTCFullYear())) { date.setUTCFullYear(y); } } else { date = new Date(Date.UTC.apply(null, arguments)); } return date; } // start-of-first-week - start-of-year function firstWeekOffset(year, dow, doy) { var // first-week day -- which january is always in the first week (4 for iso, 1 for other) fwd = 7 + dow - doy, // first-week day local weekday -- which local weekday is fwd fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear, }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear, }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } // FORMATTING addFormatToken('w', ['ww', 2], 'wo', 'week'); addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES addUnitAlias('week', 'w'); addUnitAlias('isoWeek', 'W'); // PRIORITIES addUnitPriority('week', 5); addUnitPriority('isoWeek', 5); // PARSING addRegexToken('w', match1to2); addRegexToken('ww', match1to2, match2); addRegexToken('W', match1to2); addRegexToken('WW', match1to2, match2); addWeekParseToken( ['w', 'ww', 'W', 'WW'], function (input, week, config, token) { week[token.substr(0, 1)] = toInt(input); } ); // HELPERS // LOCALES function localeWeek(mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow: 0, // Sunday is the first day of the week. doy: 6, // The week that contains Jan 6th is the first week of the year. }; function localeFirstDayOfWeek() { return this._week.dow; } function localeFirstDayOfYear() { return this._week.doy; } // MOMENTS function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); } function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); } // FORMATTING addFormatToken('d', 0, 'do', 'day'); addFormatToken('dd', 0, 0, function (format) { return this.localeData().weekdaysMin(this, format); }); addFormatToken('ddd', 0, 0, function (format) { return this.localeData().weekdaysShort(this, format); }); addFormatToken('dddd', 0, 0, function (format) { return this.localeData().weekdays(this, format); }); addFormatToken('e', 0, 0, 'weekday'); addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES addUnitAlias('day', 'd'); addUnitAlias('weekday', 'e'); addUnitAlias('isoWeekday', 'E'); // PRIORITY addUnitPriority('day', 11); addUnitPriority('weekday', 11); addUnitPriority('isoWeekday', 11); // PARSING addRegexToken('d', match1to2); addRegexToken('e', match1to2); addRegexToken('E', match1to2); addRegexToken('dd', function (isStrict, locale) { return locale.weekdaysMinRegex(isStrict); }); addRegexToken('ddd', function (isStrict, locale) { return locale.weekdaysShortRegex(isStrict); }); addRegexToken('dddd', function (isStrict, locale) { return locale.weekdaysRegex(isStrict); }); addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid if (weekday != null) { week.d = weekday; } else { getParsingFlags(config).invalidWeekday = input; } }); addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { week[token] = toInt(input); }); // HELPERS function parseWeekday(input, locale) { if (typeof input !== 'string') { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale.weekdaysParse(input); if (typeof input === 'number') { return input; } return null; } function parseIsoWeekday(input, locale) { if (typeof input === 'string') { return locale.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } // LOCALES function shiftWeekdays(ws, n) { return ws.slice(n, 7).concat(ws.slice(0, n)); } var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord; function localeWeekdays(m, format) { var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[ m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone' ]; return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays; } function localeWeekdaysShort(m) { return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort; } function localeWeekdaysMin(m) { return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i = 0; i < 7; ++i) { mom = createUTC([2000, 1]).day(i); this._minWeekdaysParse[i] = this.weekdaysMin( mom, '' ).toLocaleLowerCase(); this._shortWeekdaysParse[i] = this.weekdaysShort( mom, '' ).toLocaleLowerCase(); this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse(weekdayName, format, strict) { var i, mom, regex; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { this._fullWeekdaysParse[i] = new RegExp( '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i' ); this._shortWeekdaysParse[i] = new RegExp( '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i' ); this._minWeekdaysParse[i] = new RegExp( '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i' ); } if (!this._weekdaysParse[i]) { regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName) ) { return i; } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { return i; } } } // MOMENTS function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } } function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); } function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } function weekdaysRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, '_weekdaysRegex')) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } function weekdaysShortRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, '_weekdaysShortRegex')) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } function weekdaysMinRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, '_weekdaysMinRegex')) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse() { function cmpLenRev(a, b) { return b.length - a.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); minp = regexEscape(this.weekdaysMin(mom, '')); shortp = regexEscape(this.weekdaysShort(mom, '')); longp = regexEscape(this.weekdays(mom, '')); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } // Sorting makes sure if one weekday (or abbr) is a prefix of another it // will match the longer piece. minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._weekdaysShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); this._weekdaysMinStrictRegex = new RegExp( '^(' + minPieces.join('|') + ')', 'i' ); } // FORMATTING function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken('H', ['HH', 2], 0, 'hour'); addFormatToken('h', ['hh', 2], 0, hFormat); addFormatToken('k', ['kk', 2], 0, kFormat); addFormatToken('hmm', 0, 0, function () { return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken('hmmss', 0, 0, function () { return ( '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); addFormatToken('Hmm', 0, 0, function () { return '' + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken('Hmmss', 0, 0, function () { return ( '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); function meridiem(token, lowercase) { addFormatToken(token, 0, 0, function () { return this.localeData().meridiem( this.hours(), this.minutes(), lowercase ); }); } meridiem('a', true); meridiem('A', false); // ALIASES addUnitAlias('hour', 'h'); // PRIORITY addUnitPriority('hour', 13); // PARSING function matchMeridiem(isStrict, locale) { return locale._meridiemParse; } addRegexToken('a', matchMeridiem); addRegexToken('A', matchMeridiem); addRegexToken('H', match1to2); addRegexToken('h', match1to2); addRegexToken('k', match1to2); addRegexToken('HH', match1to2, match2); addRegexToken('hh', match1to2, match2); addRegexToken('kk', match1to2, match2); addRegexToken('hmm', match3to4); addRegexToken('hmmss', match5to6); addRegexToken('Hmm', match3to4); addRegexToken('Hmmss', match5to6); addParseToken(['H', 'HH'], HOUR); addParseToken(['k', 'kk'], function (input, array, config) { var kInput = toInt(input); array[HOUR] = kInput === 24 ? 0 : kInput; }); addParseToken(['a', 'A'], function (input, array, config) { config._isPm = config._locale.isPM(input); config._meridiem = input; }); addParseToken(['h', 'hh'], function (input, array, config) { array[HOUR] = toInt(input); getParsingFlags(config).bigHour = true; }); addParseToken('hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); getParsingFlags(config).bigHour = true; }); addParseToken('hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); getParsingFlags(config).bigHour = true; }); addParseToken('Hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); }); addParseToken('Hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); }); // LOCALES function localeIsPM(input) { // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays // Using charAt should be more compatible. return (input + '').toLowerCase().charAt(0) === 'p'; } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, // Setting the hour should keep the time, because the user explicitly // specified which hour they want. So trying to maintain the same hour (in // a new timezone) makes sense. Adding/subtracting hours does not follow // this rule. getSetHour = makeGetSet('Hours', true); function localeMeridiem(hours, minutes, isLower) { if (hours > 11) { return isLower ? 'pm' : 'PM'; } else { return isLower ? 'am' : 'AM'; } } var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse, }; // internal storage for locale config files var locales = {}, localeFamilies = {}, globalLocale; function commonPrefix(arr1, arr2) { var i, minl = Math.min(arr1.length, arr2.length); for (i = 0; i < minl; i += 1) { if (arr1[i] !== arr2[i]) { return i; } } return minl; } function normalizeLocale(key) { return key ? key.toLowerCase().replace('_', '-') : key; } // pick the locale from the array // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if ( next && next.length >= j && commonPrefix(split, next) >= j - 1 ) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return globalLocale; } function isLocaleNameSane(name) { // Prevent names that look like filesystem paths, i.e contain '/' or '\' return name.match('^[^/\\\\]*$') != null; } function loadLocale(name) { var oldLocale = null, aliasedRequire; // TODO: Find a better way to register and load all the locales in Node if ( locales[name] === undefined && typeof module !== 'undefined' && module && module.exports && isLocaleNameSane(name) ) { try { oldLocale = globalLocale._abbr; aliasedRequire = require; aliasedRequire('./locale/' + name); getSetGlobalLocale(oldLocale); } catch (e) { // mark as not found to avoid repeating expensive file require call causing high CPU // when trying to find en-US, en_US, en-us for every format call locales[name] = null; // null means not found } } return locales[name]; } // This function will load locale and then set the global locale. If // no arguments are passed in, it will simply return the current global // locale key. function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } else { if (typeof console !== 'undefined' && console.warn) { //warn user if arguments are passed but the locale could not be set console.warn( 'Locale ' + key + ' not found. Did you forget to load it?' ); } } } return globalLocale._abbr; } function defineLocale(name, config) { if (config !== null) { var locale, parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple( 'defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' ); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { locale = loadLocale(config.parentLocale); if (locale != null) { parentConfig = locale._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config, }); return null; } } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } } function updateLocale(name, config) { if (config != null) { var locale, tmpLocale, parentConfig = baseConfig; if (locales[name] != null && locales[name].parentLocale != null) { // Update existing child locale in-place to avoid memory-leaks locales[name].set(mergeConfigs(locales[name]._config, config)); } else { // MERGE tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); if (tmpLocale == null) { // updateLocale is called for creating a new locale // Set abbr so it will have a name (getters return // undefined otherwise). config.abbr = name; } locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; } // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; if (name === getSetGlobalLocale()) { getSetGlobalLocale(name); } } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } // returns locale data function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); } function listLocales() { return keys(locales); } function checkOverflow(m) { var overflow, a = m._a; if (a && getParsingFlags(m).overflow === -2) { overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; if ( getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE) ) { overflow = DATE; } if (getParsingFlags(m)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m).overflow = overflow; } return m; } // iso 8601 regex // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/], ['YYYYMM', /\d{6}/, false], ['YYYY', /\d{4}/, false], ], // iso time formats and regexes isoTimes = [ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/], ], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = { UT: 0, GMT: 0, EDT: -4 * 60, EST: -5 * 60, CDT: -5 * 60, CST: -6 * 60, MDT: -6 * 60, MST: -7 * 60, PDT: -7 * 60, PST: -8 * 60, }; // date from iso format function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDatesLen; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimesLen; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } } function extractFromRFC2822Strings( yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr ) { var result = [ untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10), ]; if (secondStr) { result.push(parseInt(secondStr, 10)); } return result; } function untruncateYear(yearStr) { var year = parseInt(yearStr, 10); if (year <= 49) { return 2000 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space return s .replace(/\([^()]*\)|[\n\t]/g, ' ') .replace(/(\s\s+)/g, ' ') .replace(/^\s\s*/, '') .replace(/\s\s*$/, ''); } function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { // TODO: Replace the vanilla JS Date object with an independent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date( parsedInput[0], parsedInput[1], parsedInput[2] ).getDay(); if (weekdayProvided !== weekdayActual) { getParsingFlags(config).weekdayMismatch = true; config._isValid = false; return false; } } return true; } function calculateOffset(obsOffset, militaryOffset, numOffset) { if (obsOffset) { return obsOffsets[obsOffset]; } else if (militaryOffset) { // the only allowed military tz is Z return 0; } else { var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100; return h * 60 + m; } } // date and time from ref 2822 format function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray; if (match) { parsedArray = extractFromRFC2822Strings( match[4], match[3], match[2], match[5], match[6], match[7] ); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } } // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } if (config._strict) { config._isValid = false; } else { // Final attempt, use Input Fallback hooks.createFromInputFallback(config); } } hooks.createFromInputFallback = deprecate( 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); } ); // Pick the first defined of two or three arguments. function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; } function currentDateArray(config) { // hooks is actually the exported moment object var nowValue = new Date(hooks.now()); if (config._useUTC) { return [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate(), ]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } // convert an array to a date. // the array should mirror the parameters below // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] function configFromArray(config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if ( config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0 ) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if ( config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0 ) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply( null, input ); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if ( config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday ) { getParsingFlags(config).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config) { var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; w = config._w; if (w.GG != null || w.W != null || w.E != null) { dow = 1; doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on // how we interpret now (local, utc, fixed offset). So create // a now version of current config (take local/utc/offset flags, and // create now). weekYear = defaults( w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year ); week = defaults(w.W, 1); weekday = defaults(w.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config._locale._week.dow; doy = config._locale._week.doy; curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. week = defaults(w.w, curWeek.week); if (w.d != null) { // weekday -- low day numbers are considered next week weekday = w.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w.e != null) { // local weekday -- counting starts from beginning of week weekday = w.e + dow; if (w.e < 0 || w.e > 6) { weekdayOverflow = true; } } else { // default to beginning of week weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config._a[YEAR] = temp.year; config._dayOfYear = temp.dayOfYear; } } // constant that refers to the ISO standard hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form hooks.RFC_2822 = function () {}; // date from string and format string function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; tokenLen = tokens.length; for (i = 0; i < tokenLen; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice( string.indexOf(parsedInput) + parsedInput.length ); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if ( config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0 ) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap( config._locale, config._a[HOUR], config._meridiem ); // handle era era = getParsingFlags(config).era; if (era !== null) { config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); } configFromArray(config); checkOverflow(config); } function meridiemFixWrap(locale, hour, meridiem) { var isPm; if (meridiem == null) { // nothing to do return hour; } if (locale.meridiemHour != null) { return locale.meridiemHour(hour, meridiem); } else if (locale.isPM != null) { // Fallback isPm = locale.isPM(meridiem); if (isPm && hour < 12) { hour += 12; } if (!isPm && hour === 12) { hour = 0; } return hour; } else { // this is not supposed to happen return hour; } } // date from string and array of format strings function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length; if (configfLen === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < configfLen; i++) { currentScore = 0; validFormatFound = false; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (isValid(tempConfig)) { validFormatFound = true; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (!bestFormatIsValid) { if ( scoreToBeat == null || currentScore < scoreToBeat || validFormatFound ) { scoreToBeat = currentScore; bestMoment = tempConfig; if (validFormatFound) { bestFormatIsValid = true; } } } else { if (currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } } extend(config, bestMoment || tempConfig); } function configFromObject(config) { if (config._d) { return; } var i = normalizeObjectUnits(config._i), dayOrDate = i.day === undefined ? i.date : i.day; config._a = map( [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) { return obj && parseInt(obj, 10); } ); configFromArray(config); } function createFromConfig(config) { var res = new Moment(checkOverflow(prepareConfig(config))); if (res._nextDay) { // Adding is smart enough around DST res.add(1, 'd'); res._nextDay = undefined; } return res; } function prepareConfig(config) { var input = config._i, format = config._f; config._locale = config._locale || getLocale(config._l); if (input === null || (format === undefined && input === '')) { return createInvalid({ nullInput: true }); } if (typeof input === 'string') { config._i = input = config._locale.preparse(input); } if (isMoment(input)) { return new Moment(checkOverflow(input)); } else if (isDate(input)) { config._d = input; } else if (isArray(format)) { configFromStringAndArray(config); } else if (format) { configFromStringAndFormat(config); } else { configFromInput(config); } if (!isValid(config)) { config._d = null; } return config; } function configFromInput(config) { var input = config._i; if (isUndefined(input)) { config._d = new Date(hooks.now()); } else if (isDate(input)) { config._d = new Date(input.valueOf()); } else if (typeof input === 'string') { configFromString(config); } else if (isArray(input)) { config._a = map(input.slice(0), function (obj) { return parseInt(obj, 10); }); configFromArray(config); } else if (isObject(input)) { configFromObject(config); } else if (isNumber(input)) { // from milliseconds config._d = new Date(input); } else { hooks.createFromInputFallback(config); } } function createLocalOrUTC(input, format, locale, strict, isUTC) { var c = {}; if (format === true || format === false) { strict = format; format = undefined; } if (locale === true || locale === false) { strict = locale; locale = undefined; } if ( (isObject(input) && isObjectEmpty(input)) || (isArray(input) && input.length === 0) ) { input = undefined; } // object construction must be done this way. // https://github.com/moment/moment/issues/1423 c._isAMomentObject = true; c._useUTC = c._isUTC = isUTC; c._l = locale; c._i = input; c._f = format; c._strict = strict; return createFromConfig(c); } function createLocal(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, false); } var prototypeMin = deprecate( 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } } ), prototypeMax = deprecate( 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } } ); // Pick a moment m from moments so that m[fn](other) is true for all // other. This relies on the function fn to be transitive. // // moments should either be an array of moment objects or an array, whose // first element is an array of moment objects. function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; } // TODO: Use [].sort instead? function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); } function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); } var now = function () { return Date.now ? Date.now() : +new Date(); }; var ordering = [ 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', ]; function isDurationValid(m) { var key, unitHasDecimal = false, i, orderLen = ordering.length; for (key in m) { if ( hasOwnProp(m, key) && !( indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])) ) ) { return false; } } for (i = 0; i < orderLen; ++i) { if (m[ordering[i]]) { if (unitHasDecimal) { return false; // only allow non-integers for smallest unit } if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { unitHasDecimal = true; } } } return true; } function isValid$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration(duration) { var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || normalizedInput.isoWeek || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 minutes * 6e4 + // 1000 * 60 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 // Because of dateAddRemove treats 24 hours as different from a // day when working around DST, we need to store them separately this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = +months + quarters * 3 + years * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration(obj) { return obj instanceof Duration; } function absRound(number) { if (number < 0) { return Math.round(-1 * number) * -1; } else { return Math.round(number); } } // compare two arrays, return the number of differences function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ( (dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) ) { diffs++; } } return diffs + lengthDiff; } // FORMATTING function offset(token, separator) { addFormatToken(token, 0, 0, function () { var offset = this.utcOffset(), sign = '+'; if (offset < 0) { offset = -offset; sign = '-'; } return ( sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2) ); }); } offset('Z', ':'); offset('ZZ', ''); // PARSING addRegexToken('Z', matchShortOffset); addRegexToken('ZZ', matchShortOffset); addParseToken(['Z', 'ZZ'], function (input, array, config) { config._useUTC = true; config._tzm = offsetFromString(matchShortOffset, input); }); // HELPERS // timezone chunker // '+10:00' > ['10', '00'] // '-1530' > ['-15', '30'] var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string) { var matches = (string || '').match(matcher), chunk, parts, minutes; if (matches === null) { return null; } chunk = matches[matches.length - 1] || []; parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; minutes = +(parts[1] * 60) + toInt(parts[2]); return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; } // Return a moment from input, that is local/utc/zone equivalent to model. function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset(m) { // On Firefox.24 Date#getTimezoneOffset returns a floating point. // https://github.com/moment/moment/pull/1871 return -Math.round(m._d.getTimezoneOffset()); } // HOOKS // This function will be called whenever a moment is mutated. // It is intended to keep the offset in sync with the timezone. hooks.updateOffset = function () {}; // MOMENTS // keepLocalTime = true means only change the timezone, without // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset // +0200, so we adjust the time as needed, to be valid. // // Keeping the time actually adds/subtracts (one hour) // from the actual represented time. That is why we call updateOffset // a second time. In case it wants us to change the offset again // _changeInProgress == true case, then we have to adjust, because // there is no such time in the given timezone. function getSetOffset(input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract( this, createDuration(input - offset, 'm'), 1, false ); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } } function getSetZone(input, keepLocalTime) { if (input != null) { if (typeof input !== 'string') { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; } function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime() { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); } function isDaylightSavingTimeShifted() { if (!isUndefined(this._isDSTShifted)) { return this._isDSTShifted; } var c = {}, other; copyConfig(c, this); c = prepareConfig(c); if (c._a) { other = c._isUTC ? createUTC(c._a) : createLocal(c._a); this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal() { return this.isValid() ? !this._isUTC : false; } function isUtcOffset() { return this.isValid() ? this._isUTC : false; } function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; } // ASP.NET json date format regex var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // and further modified to allow for strings containing both week and day isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms: input._milliseconds, d: input._days, M: input._months, }; } else if (isNumber(input) || !isNaN(+input)) { duration = {}; if (key) { duration[key] = +input; } else { duration.milliseconds = +input; } } else if ((match = aspNetRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: 0, d: toInt(match[DATE]) * sign, h: toInt(match[HOUR]) * sign, m: toInt(match[MINUTE]) * sign, s: toInt(match[SECOND]) * sign, ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match }; } else if ((match = isoRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: parseIso(match[2], sign), M: parseIso(match[3], sign), w: parseIso(match[4], sign), d: parseIso(match[5], sign), h: parseIso(match[6], sign), m: parseIso(match[7], sign), s: parseIso(match[8], sign), }; } else if (duration == null) { // checks for null or undefined duration = {}; } else if ( typeof duration === 'object' && ('from' in duration || 'to' in duration) ) { diffRes = momentsDifference( createLocal(duration.from), createLocal(duration.to) ); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } if (isDuration(input) && hasOwnProp(input, '_isValid')) { ret._isValid = input._isValid; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso(inp, sign) { // We'd normally use ~~inp for this, but unfortunately it also // converts floats to ints. // inp may be undefined, so careful calling replace on it. var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it return (isNaN(res) ? 0 : res) * sign; } function positiveMomentsDifference(base, other) { var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, 'M').isAfter(other)) { --res.months; } res.milliseconds = +other - +base.clone().add(res.months, 'M'); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } // TODO: remove 'name' arg after deprecation is removed function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple( name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' ); tmp = val; val = period; period = tmp; } dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract(mom, duration, isAdding, updateOffset) { var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months); if (!mom.isValid()) { // No op return; } updateOffset = updateOffset == null ? true : updateOffset; if (months) { setMonth(mom, get(mom, 'Month') + months * isAdding); } if (days) { set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } if (milliseconds) { mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days || months); } } var add = createAdder(1, 'add'), subtract = createAdder(-1, 'subtract'); function isString(input) { return typeof input === 'string' || input instanceof String; } // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined function isMomentInput(input) { return ( isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === undefined ); } function isMomentInputObject(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms', ], i, property, propertyLen = properties.length; for (i = 0; i < propertyLen; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function isNumberOrStringArray(input) { var arrayTest = isArray(input), dataTypeTest = false; if (arrayTest) { dataTypeTest = input.filter(function (item) { return !isNumber(item) && isString(input); }).length === 0; } return arrayTest && dataTypeTest; } function isCalendarSpec(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'sameDay', 'nextDay', 'lastDay', 'nextWeek', 'lastWeek', 'sameElse', ], i, property; for (i = 0; i < properties.length; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; } function calendar$1(time, formats) { // Support for single parameter, formats only overload to the calendar function if (arguments.length === 1) { if (!arguments[0]) { time = undefined; formats = undefined; } else if (isMomentInput(arguments[0])) { time = arguments[0]; formats = undefined; } else if (isCalendarSpec(arguments[0])) { formats = arguments[0]; time = undefined; } } // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse', output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format( output || this.localeData().calendar(format, this, createLocal(now)) ); } function clone() { return new Moment(this); } function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween(from, to, units, inclusivity) { var localFrom = isMoment(from) ? from : createLocal(from), localTo = isMoment(to) ? to : createLocal(to); if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { return false; } inclusivity = inclusivity || '()'; return ( (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)) ); } function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return ( this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf() ); } } function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input, units); } function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input, units); } function diff(input, units, asFloat) { var that, zoneDelta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case 'year': output = monthDiff(this, that) / 12; break; case 'month': output = monthDiff(this, that); break; case 'quarter': output = monthDiff(this, that) / 3; break; case 'second': output = (this - that) / 1e3; break; // 1000 case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff(a, b) { if (a.date() < b.date()) { // end-of-month calculations work correct when the start month has more // days than the end month. return -monthDiff(b, a); } // difference in months var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), // b is in (anchor - 1 month, anchor + 1 month) anchor = a.clone().add(wholeMonthDiff, 'months'), anchor2, adjust; if (b - anchor < 0) { anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor - anchor2); } else { anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor2 - anchor); } //check for negative zero, return zero if negative zero return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; function toString() { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true, m = utc ? this.clone().utc() : this; if (m.year() < 0 || m.year() > 9999) { return formatMoment( m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can if (utc) { return this.toDate().toISOString(); } else { return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) .toISOString() .replace('Z', formatMoment(m, 'Z')); } } return formatMoment( m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } /** * Return a human readable representation of a moment that can * also be evaluated to get a new moment which is the same * * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects */ function inspect() { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment', zone = '', prefix, year, datetime, suffix; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } prefix = '[' + func + '("]'; year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; datetime = '-MM-DD[T]HH:mm:ss.SSS'; suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ to: this, from: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ from: this, to: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } // If passed a locale key, it will set the locale for this // instance. Otherwise, it will return the locale configuration // variables for this instance. function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate( 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { if (key === undefined) { return this.localeData(); } else { return this.locale(key); } } ); function localeData() { return this._locale; } var MS_PER_SECOND = 1000, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970): function mod$1(dividend, divisor) { return ((dividend % divisor) + divisor) % divisor; } function localStartOfDate(y, m, d) { // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return new Date(y + 400, m, d) - MS_PER_400_YEARS; } else { return new Date(y, m, d).valueOf(); } } function utcStartOfDate(y, m, d) { // Date.UTC remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; } else { return Date.UTC(y, m, d); } } function startOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year(), 0, 1); break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3), 1 ); break; case 'month': time = startOfDate(this.year(), this.month(), 1); break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() ); break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) ); break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date()); break; case 'hour': time = this._d.valueOf(); time -= mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ); break; case 'minute': time = this._d.valueOf(); time -= mod$1(time, MS_PER_MINUTE); break; case 'second': time = this._d.valueOf(); time -= mod$1(time, MS_PER_SECOND); break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function endOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year() + 1, 0, 1) - 1; break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3) + 3, 1 ) - 1; break; case 'month': time = startOfDate(this.year(), this.month() + 1, 1) - 1; break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() + 7 ) - 1; break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7 ) - 1; break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case 'hour': time = this._d.valueOf(); time += MS_PER_HOUR - mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ) - 1; break; case 'minute': time = this._d.valueOf(); time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; break; case 'second': time = this._d.valueOf(); time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function valueOf() { return this._d.valueOf() - (this._offset || 0) * 60000; } function unix() { return Math.floor(this.valueOf() / 1000); } function toDate() { return new Date(this.valueOf()); } function toArray() { var m = this; return [ m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond(), ]; } function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds(), }; } function toJSON() { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; } function isValid$2() { return isValid(this); } function parsingFlags() { return extend({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict, }; } addFormatToken('N', 0, 0, 'eraAbbr'); addFormatToken('NN', 0, 0, 'eraAbbr'); addFormatToken('NNN', 0, 0, 'eraAbbr'); addFormatToken('NNNN', 0, 0, 'eraName'); addFormatToken('NNNNN', 0, 0, 'eraNarrow'); addFormatToken('y', ['y', 1], 'yo', 'eraYear'); addFormatToken('y', ['yy', 2], 0, 'eraYear'); addFormatToken('y', ['yyy', 3], 0, 'eraYear'); addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); addRegexToken('N', matchEraAbbr); addRegexToken('NN', matchEraAbbr); addRegexToken('NNN', matchEraAbbr); addRegexToken('NNNN', matchEraName); addRegexToken('NNNNN', matchEraNarrow); addParseToken( ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (input, array, config, token) { var era = config._locale.erasParse(input, token, config._strict); if (era) { getParsingFlags(config).era = era; } else { getParsingFlags(config).invalidEra = input; } } ); addRegexToken('y', matchUnsigned); addRegexToken('yy', matchUnsigned); addRegexToken('yyy', matchUnsigned); addRegexToken('yyyy', matchUnsigned); addRegexToken('yo', matchEraYearOrdinal); addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); addParseToken(['yo'], function (input, array, config, token) { var match; if (config._locale._eraYearOrdinalRegex) { match = input.match(config._locale._eraYearOrdinalRegex); } if (config._locale.eraYearOrdinalParse) { array[YEAR] = config._locale.eraYearOrdinalParse(input, match); } else { array[YEAR] = parseInt(input, 10); } }); function localeEras(m, format) { var i, l, date, eras = this._eras || getLocale('en')._eras; for (i = 0, l = eras.length; i < l; ++i) { switch (typeof eras[i].since) { case 'string': // truncate time date = hooks(eras[i].since).startOf('day'); eras[i].since = date.valueOf(); break; } switch (typeof eras[i].until) { case 'undefined': eras[i].until = +Infinity; break; case 'string': // truncate time date = hooks(eras[i].until).startOf('day').valueOf(); eras[i].until = date.valueOf(); break; } } return eras; } function localeErasParse(eraName, format, strict) { var i, l, eras = this.eras(), name, abbr, narrow; eraName = eraName.toUpperCase(); for (i = 0, l = eras.length; i < l; ++i) { name = eras[i].name.toUpperCase(); abbr = eras[i].abbr.toUpperCase(); narrow = eras[i].narrow.toUpperCase(); if (strict) { switch (format) { case 'N': case 'NN': case 'NNN': if (abbr === eraName) { return eras[i]; } break; case 'NNNN': if (name === eraName) { return eras[i]; } break; case 'NNNNN': if (narrow === eraName) { return eras[i]; } break; } } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { return eras[i]; } } } function localeErasConvertYear(era, year) { var dir = era.since <= era.until ? +1 : -1; if (year === undefined) { return hooks(era.since).year(); } else { return hooks(era.since).year() + (year - era.offset) * dir; } } function getEraName() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].name; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].name; } } return ''; } function getEraNarrow() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].narrow; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].narrow; } } return ''; } function getEraAbbr() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].abbr; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].abbr; } } return ''; } function getEraYear() { var i, l, dir, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { dir = eras[i].since <= eras[i].until ? +1 : -1; // truncate time val = this.clone().startOf('day').valueOf(); if ( (eras[i].since <= val && val <= eras[i].until) || (eras[i].until <= val && val <= eras[i].since) ) { return ( (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset ); } } return this.year(); } function erasNameRegex(isStrict) { if (!hasOwnProp(this, '_erasNameRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNameRegex : this._erasRegex; } function erasAbbrRegex(isStrict) { if (!hasOwnProp(this, '_erasAbbrRegex')) { computeErasParse.call(this); } return isStrict ? this._erasAbbrRegex : this._erasRegex; } function erasNarrowRegex(isStrict) { if (!hasOwnProp(this, '_erasNarrowRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNarrowRegex : this._erasRegex; } function matchEraAbbr(isStrict, locale) { return locale.erasAbbrRegex(isStrict); } function matchEraName(isStrict, locale) { return locale.erasNameRegex(isStrict); } function matchEraNarrow(isStrict, locale) { return locale.erasNarrowRegex(isStrict); } function matchEraYearOrdinal(isStrict, locale) { return locale._eraYearOrdinalRegex || matchUnsigned; } function computeErasParse() { var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, eras = this.eras(); for (i = 0, l = eras.length; i < l; ++i) { namePieces.push(regexEscape(eras[i].name)); abbrPieces.push(regexEscape(eras[i].abbr)); narrowPieces.push(regexEscape(eras[i].narrow)); mixedPieces.push(regexEscape(eras[i].name)); mixedPieces.push(regexEscape(eras[i].abbr)); mixedPieces.push(regexEscape(eras[i].narrow)); } this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); this._erasNarrowRegex = new RegExp( '^(' + narrowPieces.join('|') + ')', 'i' ); } // FORMATTING addFormatToken(0, ['gg', 2], 0, function () { return this.weekYear() % 100; }); addFormatToken(0, ['GG', 2], 0, function () { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken(token, getter) { addFormatToken(0, [token, token.length], 0, getter); } addWeekYearFormatToken('gggg', 'weekYear'); addWeekYearFormatToken('ggggg', 'weekYear'); addWeekYearFormatToken('GGGG', 'isoWeekYear'); addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES addUnitAlias('weekYear', 'gg'); addUnitAlias('isoWeekYear', 'GG'); // PRIORITY addUnitPriority('weekYear', 1); addUnitPriority('isoWeekYear', 1); // PARSING addRegexToken('G', matchSigned); addRegexToken('g', matchSigned); addRegexToken('GG', match1to2, match2); addRegexToken('gg', match1to2, match2); addRegexToken('GGGG', match1to4, match4); addRegexToken('gggg', match1to4, match4); addRegexToken('GGGGG', match1to6, match6); addRegexToken('ggggg', match1to6, match6); addWeekParseToken( ['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { week[token.substr(0, 2)] = toInt(input); } ); addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { week[token] = hooks.parseTwoDigitYear(input); }); // MOMENTS function getSetWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy ); } function getSetISOWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.isoWeek(), this.isoWeekday(), 1, 4 ); } function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); } function getISOWeeksInISOWeekYear() { return weeksInYear(this.isoWeekYear(), 1, 4); } function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getWeeksInWeekYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date.getUTCFullYear()); this.month(date.getUTCMonth()); this.date(date.getUTCDate()); return this; } // FORMATTING addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES addUnitAlias('quarter', 'Q'); // PRIORITY addUnitPriority('quarter', 7); // PARSING addRegexToken('Q', match1); addParseToken('Q', function (input, array) { array[MONTH] = (toInt(input) - 1) * 3; }); // MOMENTS function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + (this.month() % 3)); } // FORMATTING addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES addUnitAlias('date', 'D'); // PRIORITY addUnitPriority('date', 9); // PARSING addRegexToken('D', match1to2); addRegexToken('DD', match1to2, match2); addRegexToken('Do', function (isStrict, locale) { // TODO: Remove "ordinalParse" fallback in next major release. return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; }); addParseToken(['D', 'DD'], DATE); addParseToken('Do', function (input, array) { array[DATE] = toInt(input.match(match1to2)[0]); }); // MOMENTS var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES addUnitAlias('dayOfYear', 'DDD'); // PRIORITY addUnitPriority('dayOfYear', 4); // PARSING addRegexToken('DDD', match1to3); addRegexToken('DDDD', match3); addParseToken(['DDD', 'DDDD'], function (input, array, config) { config._dayOfYear = toInt(input); }); // HELPERS // MOMENTS function getSetDayOfYear(input) { var dayOfYear = Math.round( (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 ) + 1; return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); } // FORMATTING addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES addUnitAlias('minute', 'm'); // PRIORITY addUnitPriority('minute', 14); // PARSING addRegexToken('m', match1to2); addRegexToken('mm', match1to2, match2); addParseToken(['m', 'mm'], MINUTE); // MOMENTS var getSetMinute = makeGetSet('Minutes', false); // FORMATTING addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES addUnitAlias('second', 's'); // PRIORITY addUnitPriority('second', 15); // PARSING addRegexToken('s', match1to2); addRegexToken('ss', match1to2, match2); addParseToken(['s', 'ss'], SECOND); // MOMENTS var getSetSecond = makeGetSet('Seconds', false); // FORMATTING addFormatToken('S', 0, 0, function () { return ~~(this.millisecond() / 100); }); addFormatToken(0, ['SS', 2], 0, function () { return ~~(this.millisecond() / 10); }); addFormatToken(0, ['SSS', 3], 0, 'millisecond'); addFormatToken(0, ['SSSS', 4], 0, function () { return this.millisecond() * 10; }); addFormatToken(0, ['SSSSS', 5], 0, function () { return this.millisecond() * 100; }); addFormatToken(0, ['SSSSSS', 6], 0, function () { return this.millisecond() * 1000; }); addFormatToken(0, ['SSSSSSS', 7], 0, function () { return this.millisecond() * 10000; }); addFormatToken(0, ['SSSSSSSS', 8], 0, function () { return this.millisecond() * 100000; }); addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { return this.millisecond() * 1000000; }); // ALIASES addUnitAlias('millisecond', 'ms'); // PRIORITY addUnitPriority('millisecond', 16); // PARSING addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); var token, getSetMillisecond; for (token = 'SSSS'; token.length <= 9; token += 'S') { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); } for (token = 'S'; token.length <= 9; token += 'S') { addParseToken(token, parseMs); } getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING addFormatToken('z', 0, 0, 'zoneAbbr'); addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS function getZoneAbbr() { return this._isUTC ? 'UTC' : ''; } function getZoneName() { return this._isUTC ? 'Coordinated Universal Time' : ''; } var proto = Moment.prototype; proto.add = add; proto.calendar = calendar$1; proto.clone = clone; proto.diff = diff; proto.endOf = endOf; proto.format = format; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2; proto.lang = lang; proto.locale = locale; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray; proto.toObject = toObject; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect; if (typeof Symbol !== 'undefined' && Symbol.for != null) { proto[Symbol.for('nodejs.util.inspect.custom')] = function () { return 'Moment<' + this.format() + '>'; }; } proto.toJSON = toJSON; proto.toString = toString; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; proto.eraName = getEraName; proto.eraNarrow = getEraNarrow; proto.eraAbbr = getEraAbbr; proto.eraYear = getEraYear; proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; proto.quarter = proto.quarters = getSetQuarter; proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.weeksInWeekYear = getWeeksInWeekYear; proto.isoWeeksInYear = getISOWeeksInYear; proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; proto.hour = proto.hours = getSetHour; proto.minute = proto.minutes = getSetMinute; proto.second = proto.seconds = getSetSecond; proto.millisecond = proto.milliseconds = getSetMillisecond; proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; proto.dates = deprecate( 'dates accessor is deprecated. Use date instead.', getSetDayOfMonth ); proto.months = deprecate( 'months accessor is deprecated. Use month instead', getSetMonth ); proto.years = deprecate( 'years accessor is deprecated. Use year instead', getSetYear ); proto.zone = deprecate( 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone ); proto.isDSTShifted = deprecate( 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted ); function createUnix(input) { return createLocal(input * 1000); } function createInZone() { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat(string) { return string; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set; proto$1.eras = localeEras; proto$1.erasParse = localeErasParse; proto$1.erasConvertYear = localeErasConvertYear; proto$1.erasAbbrRegex = erasAbbrRegex; proto$1.erasNameRegex = erasNameRegex; proto$1.erasNarrowRegex = erasNarrowRegex; proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1(format, index, field, setter) { var locale = getLocale(), utc = createUTC().set(setter, index); return locale[field](utc, format); } function listMonthsImpl(format, index, field) { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; if (index != null) { return get$1(format, index, field, 'month'); } var i, out = []; for (i = 0; i < 12; i++) { out[i] = get$1(format, i, field, 'month'); } return out; } // () // (5) // (fmt, 5) // (fmt) // (true) // (true, 5) // (true, fmt, 5) // (true, fmt) function listWeekdaysImpl(localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0, i, out = []; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; } function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); } function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); } function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); } function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); } function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); } getSetGlobalLocale('en', { eras: [ { since: '0001-01-01', until: +Infinity, offset: 1, name: 'Anno Domini', narrow: 'AD', abbr: 'AD', }, { since: '0000-12-31', until: -Infinity, offset: 1, name: 'Before Christ', narrow: 'BC', abbr: 'BC', }, ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function (number) { var b = number % 10, output = toInt((number % 100) / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; return number + output; }, }); // Side effect imports hooks.lang = deprecate( 'moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale ); hooks.langData = deprecate( 'moment.langData is deprecated. Use moment.localeData instead.', getLocale ); var mathAbs = Math.abs; function abs() { var data = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data.milliseconds = mathAbs(data.milliseconds); data.seconds = mathAbs(data.seconds); data.minutes = mathAbs(data.minutes); data.hours = mathAbs(data.hours); data.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; } function addSubtract$1(duration, input, value, direction) { var other = createDuration(input, value); duration._milliseconds += direction * other._milliseconds; duration._days += direction * other._days; duration._months += direction * other._months; return duration._bubble(); } // supports only 2.0-style add(1, 's') or add(duration) function add$1(input, value) { return addSubtract$1(this, input, value, 1); } // supports only 2.0-style subtract(1, 's') or subtract(duration) function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); } function absCeil(number) { if (number < 0) { return Math.floor(number); } else { return Math.ceil(number); } } function bubble() { var milliseconds = this._milliseconds, days = this._days, months = this._months, data = this._data, seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first // check: https://github.com/moment/moment/issues/2166 if ( !( (milliseconds >= 0 && days >= 0 && months >= 0) || (milliseconds <= 0 && days <= 0 && months <= 0) ) ) { milliseconds += absCeil(monthsToDays(months) + days) * 864e5; days = 0; months = 0; } // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds = absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes = absFloor(seconds / 60); data.minutes = minutes % 60; hours = absFloor(minutes / 60); data.hours = hours % 24; days += absFloor(hours / 24); // convert days to months monthsFromDays = absFloor(daysToMonths(days)); months += monthsFromDays; days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year years = absFloor(months / 12); months %= 12; data.days = days; data.months = months; data.years = years; return this; } function daysToMonths(days) { // 400 years have 146097 days (taking into account leap year rules) // 400 years have 12 months === 4800 return (days * 4800) / 146097; } function monthsToDays(months) { // the reverse of daysToMonths return (months * 146097) / 4800; } function as(units) { if (!this.isValid()) { return NaN; } var days, months, milliseconds = this._milliseconds; units = normalizeUnits(units); if (units === 'month' || units === 'quarter' || units === 'year') { days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); switch (units) { case 'month': return months; case 'quarter': return months / 3; case 'year': return months / 12; } } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); switch (units) { case 'week': return days / 7 + milliseconds / 6048e5; case 'day': return days + milliseconds / 864e5; case 'hour': return days * 24 + milliseconds / 36e5; case 'minute': return days * 1440 + milliseconds / 6e4; case 'second': return days * 86400 + milliseconds / 1000; // Math.floor prevents floating point math errors here case 'millisecond': return Math.floor(days * 864e5) + milliseconds; default: throw new Error('Unknown unit ' + units); } } } // TODO: Use this.as('ms')? function valueOf$1() { if (!this.isValid()) { return NaN; } return ( this._milliseconds + this._days * 864e5 + (this._months % 12) * 2592e6 + toInt(this._months / 12) * 31536e6 ); } function makeAs(alias) { return function () { return this.as(alias); }; } var asMilliseconds = makeAs('ms'), asSeconds = makeAs('s'), asMinutes = makeAs('m'), asHours = makeAs('h'), asDays = makeAs('d'), asWeeks = makeAs('w'), asMonths = makeAs('M'), asQuarters = makeAs('Q'), asYears = makeAs('y'); function clone$1() { return createDuration(this); } function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; } function makeGetter(name) { return function () { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter('milliseconds'), seconds = makeGetter('seconds'), minutes = makeGetter('minutes'), hours = makeGetter('hours'), days = makeGetter('days'), months = makeGetter('months'), years = makeGetter('years'); function weeks() { return absFloor(this.days() / 7); } var round = Math.round, thresholds = { ss: 44, // a few seconds to seconds s: 45, // seconds to minute m: 45, // minutes to hour h: 22, // hours to day d: 26, // days to month/week w: null, // weeks to month M: 11, // months to year }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { var duration = createDuration(posNegDuration).abs(), seconds = round(duration.as('s')), minutes = round(duration.as('m')), hours = round(duration.as('h')), days = round(duration.as('d')), months = round(duration.as('M')), weeks = round(duration.as('w')), years = round(duration.as('y')), a = (seconds <= thresholds.ss && ['s', seconds]) || (seconds < thresholds.s && ['ss', seconds]) || (minutes <= 1 && ['m']) || (minutes < thresholds.m && ['mm', minutes]) || (hours <= 1 && ['h']) || (hours < thresholds.h && ['hh', hours]) || (days <= 1 && ['d']) || (days < thresholds.d && ['dd', days]); if (thresholds.w != null) { a = a || (weeks <= 1 && ['w']) || (weeks < thresholds.w && ['ww', weeks]); } a = a || (months <= 1 && ['M']) || (months < thresholds.M && ['MM', months]) || (years <= 1 && ['y']) || ['yy', years]; a[2] = withoutSuffix; a[3] = +posNegDuration > 0; a[4] = locale; return substituteTimeAgo.apply(null, a); } // This function allows you to set the rounding function for relative time strings function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof roundingFunction === 'function') { round = roundingFunction; return true; } return false; } // This function allows you to set a threshold for relative time strings function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; } function humanize(argWithSuffix, argThresholds) { if (!this.isValid()) { return this.localeData().invalidDate(); } var withSuffix = false, th = thresholds, locale, output; if (typeof argWithSuffix === 'object') { argThresholds = argWithSuffix; argWithSuffix = false; } if (typeof argWithSuffix === 'boolean') { withSuffix = argWithSuffix; } if (typeof argThresholds === 'object') { th = Object.assign({}, thresholds, argThresholds); if (argThresholds.s != null && argThresholds.ss == null) { th.ss = argThresholds.s - 1; } } locale = this.localeData(); output = relativeTime$1(this, !withSuffix, th, locale); if (withSuffix) { output = locale.pastFuture(+this, output); } return locale.postformat(output); } var abs$1 = Math.abs; function sign(x) { return (x > 0) - (x < 0) || +x; } function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), minutes, hours, years, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign; if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; totalSign = total < 0 ? '-' : ''; ymSign = sign(this._months) !== sign(total) ? '-' : ''; daysSign = sign(this._days) !== sign(total) ? '-' : ''; hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; return ( totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '') ); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1; proto$2.abs = abs; proto$2.add = add$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale; proto$2.localeData = localeData; proto$2.toIsoString = deprecate( 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1 ); proto$2.lang = lang; // FORMATTING addFormatToken('X', 0, 0, 'unix'); addFormatToken('x', 0, 0, 'valueOf'); // PARSING addRegexToken('x', matchSigned); addRegexToken('X', matchTimestamp); addParseToken('X', function (input, array, config) { config._d = new Date(parseFloat(input) * 1000); }); addParseToken('x', function (input, array, config) { config._d = new Date(toInt(input)); }); //! moment.js hooks.version = '2.29.4'; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats hooks.HTML5_FMT = { DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // DATE: 'YYYY-MM-DD', // TIME: 'HH:mm', // TIME_SECONDS: 'HH:mm:ss', // TIME_MS: 'HH:mm:ss.SSS', // WEEK: 'GGGG-[W]WW', // MONTH: 'YYYY-MM', // }; return hooks; }))); define('moment', ['moment/moment'], function (main) { return main; }); define('frontend',['fast', 'template', 'moment'], function (Fast, Template, Moment) { var Frontend = { api: Fast.api, init: function () { var si = {}; //发送验证码 $(document).on("click", ".btn-captcha", function (e) { var type = $(this).data("type") ? $(this).data("type") : 'mobile'; var btn = this; Frontend.api.sendcaptcha = function (btn, type, data, callback) { $(btn).addClass("disabled", true).text("发送中..."); Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) { clearInterval(si[type]); var seconds = 60; si[type] = setInterval(function () { seconds--; if (seconds <= 0) { clearInterval(si); $(btn).removeClass("disabled").text("发送验证码"); } else { $(btn).addClass("disabled").text(seconds + "秒后可再次发送"); } }, 1000); if (typeof callback == 'function') { callback.call(this, data, ret); } }, function () { $(btn).removeClass("disabled").text('发送验证码'); }); }; if (['mobile', 'email'].indexOf(type) > -1) { var element = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : $("input[name='" + type + "']", $(this).closest("form")); var text = type === 'email' ? '邮箱' : '手机号码'; if (element.val() === "") { Layer.msg(text + "不能为空!"); element.focus(); return false; } else if (type === 'mobile' && !element.val().match(/^1[3-9]\d{9}$/)) { Layer.msg("请输入正确的" + text + "!"); element.focus(); return false; } else if (type === 'email' && !element.val().match(/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/)) { Layer.msg("请输入正确的" + text + "!"); element.focus(); return false; } element.isValid(function (v) { if (v) { var data = {event: $(btn).data("event")}; data[type] = element.val(); Frontend.api.sendcaptcha(btn, type, data); } else { Layer.msg("请确认已经输入了正确的" + text + "!"); } }); } else { var data = {event: $(btn).data("event")}; Frontend.api.sendcaptcha(btn, type, data, function (data, ret) { Layer.open({title: false, area: ["400px", "430px"], content: "
扫一扫关注公众号获取验证码
", type: 1}); }); } return false; }); //tooltip和popover if (!('ontouchstart' in document.documentElement)) { $('body').tooltip({selector: '[data-toggle="tooltip"]'}); } $('body').popover({selector: '[data-toggle="popover"]'}); // 手机端左右滑动切换菜单栏 if ('ontouchstart' in document.documentElement) { var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element; element = $('body', document); element.on("touchstart", function (e) { startX = e.originalEvent.changedTouches[0].pageX; startY = e.originalEvent.changedTouches[0].pageY; }); element.on("touchend", function (e) { moveEndX = e.originalEvent.changedTouches[0].pageX; moveEndY = e.originalEvent.changedTouches[0].pageY; relativeX = moveEndX - startX; relativeY = moveEndY - startY; // 判断标准 //右滑 if (relativeX > 45) { if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) { element.addClass("sidebar-open"); } } //左滑 else if (relativeX < -45) { if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) { element.removeClass("sidebar-open"); } } }); } $(document).on("click", ".sidebar-toggle", function () { $("body").toggleClass("sidebar-open"); }); } }; Frontend.api = $.extend(Fast.api, Frontend.api); //将Template渲染至全局,以便于在子框架中调用 window.Template = Template; //将Moment渲染至全局,以便于在子框架中调用 window.Moment = Moment; //将Frontend渲染至全局,以便于在子框架中调用 window.Frontend = Frontend; Frontend.init(); return Frontend; }); define('frontend-init',['frontend'], function (Frontend) { }); //! moment.js locale configuration //! locale : Chinese (China) [zh-cn] //! author : suupic : https://github.com/suupic //! author : Zeno Zeng : https://github.com/zenozeng //! author : uu109 : https://github.com/uu109 ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; //! moment.js locale configuration var zhCn = moment.defineLocale('zh-cn', { months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( '_' ), monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( '_' ), weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'), weekdaysMin: '日_一_二_三_四_五_六'.split('_'), longDateFormat: { LT: 'HH:mm', LTS: 'HH:mm:ss', L: 'YYYY/MM/DD', LL: 'YYYY年M月D日', LLL: 'YYYY年M月D日Ah点mm分', LLLL: 'YYYY年M月D日ddddAh点mm分', l: 'YYYY/M/D', ll: 'YYYY年M月D日', lll: 'YYYY年M月D日 HH:mm', llll: 'YYYY年M月D日dddd HH:mm', }, meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, meridiemHour: function (hour, meridiem) { if (hour === 12) { hour = 0; } if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { return hour; } else if (meridiem === '下午' || meridiem === '晚上') { return hour + 12; } else { // '中午' return hour >= 11 ? hour : hour + 12; } }, meridiem: function (hour, minute, isLower) { var hm = hour * 100 + minute; if (hm < 600) { return '凌晨'; } else if (hm < 900) { return '早上'; } else if (hm < 1130) { return '上午'; } else if (hm < 1230) { return '中午'; } else if (hm < 1800) { return '下午'; } else { return '晚上'; } }, calendar: { sameDay: '[今天]LT', nextDay: '[明天]LT', nextWeek: function (now) { if (now.week() !== this.week()) { return '[下]dddLT'; } else { return '[本]dddLT'; } }, lastDay: '[昨天]LT', lastWeek: function (now) { if (this.week() !== now.week()) { return '[上]dddLT'; } else { return '[本]dddLT'; } }, sameElse: 'L', }, dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, ordinal: function (number, period) { switch (period) { case 'd': case 'D': case 'DDD': return number + '日'; case 'M': return number + '月'; case 'w': case 'W': return number + '周'; default: return number; } }, relativeTime: { future: '%s后', past: '%s前', s: '几秒', ss: '%d 秒', m: '1 分钟', mm: '%d 分钟', h: '1 小时', hh: '%d 小时', d: '1 天', dd: '%d 天', w: '1 周', ww: '%d 周', M: '1 个月', MM: '%d 个月', y: '1 年', yy: '%d 年', }, week: { // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 dow: 1, // Monday is the first day of the week. doy: 4, // The week that contains Jan 4th is the first week of the year. }, }); return zhCn; }))); !function($){"use strict";var cachedWidth=null,sprintf=function(str){var args=arguments,flag=!0,i=1;return str=str.replace(/%s/g,function(){var arg=args[i++];return void 0===arg?(flag=!1,""):arg}),flag?str:""},getPropertyFromOther=function(list,from,to,value){var result="";return $.each(list,function(i,item){return item[from]!==value||(result=item[to],!1)}),result},getFieldIndex=function(columns,field){var index=-1;return $.each(columns,function(i,column){return column.field!==field||(index=i,!1)}),index},setFieldIndex=function(columns){var i,j,k,totalCol=0,flag=[];for(i=0;i").addClass("fixed-table-scroll-inner"),outer=$("
").addClass("fixed-table-scroll-outer");outer.append(inner),$("body").append(outer),w1=inner[0].offsetWidth,outer.css("overflow","scroll"),w1===(w2=inner[0].offsetWidth)&&(w2=outer[0].clientWidth),outer.remove(),cachedWidth=w1-w2}return cachedWidth},calculateObjectValue=function(self,name,args,defaultValue){var func=name;if("string"==typeof name){var names=name.split(".");names.length>1?(func=window,$.each(names,function(i,f){func=func[f]})):func=window[name]}return"object"==typeof func?func:"function"==typeof func?func.apply(self,args||[]):!func&&"string"==typeof name&&sprintf.apply(this,[name].concat(args))?sprintf.apply(this,[name].concat(args)):defaultValue},compareObjects=function(objectA,objectB,compareLength){var objectAProperties=Object.getOwnPropertyNames(objectA),objectBProperties=Object.getOwnPropertyNames(objectB),propName="";if(compareLength&&objectAProperties.length!==objectBProperties.length)return!1;for(var i=0;i-1&&objectA[propName]!==objectB[propName])return!1;return!0},escapeHTML=function(text){return"string"==typeof text?text.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`"):text},getRealDataAttr=function(dataAttr){for(var attr in dataAttr){var auxAttr=attr.split(/(?=[A-Z])/).join("-").toLowerCase();auxAttr!==attr&&(dataAttr[auxAttr]=dataAttr[attr],delete dataAttr[attr])}return dataAttr},getItemField=function(item,field,escape){var value=item;if("string"!=typeof field||item.hasOwnProperty(field))return escape?escapeHTML(item[field]):item[field];var props=field.split(".");for(var p in props)props.hasOwnProperty(p)&&(value=value&&value[props[p]]);return escape?escapeHTML(value):value},isIEBrowser=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},BootstrapTable=function(el,options){this.options=options,this.$el=$(el),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};BootstrapTable.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(params){return params},queryParamsType:"limit",responseHandler:function(res){return res},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(index,row){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:$.noop,customSort:$.noop,rowStyle:function(row,index){return{}},rowAttributes:function(row,index){return{}},footerStyle:function(row,index){return{}},onAll:function(name,args){return!1},onClickCell:function(field,value,row,$element){return!1},onDblClickCell:function(field,value,row,$element){return!1},onClickRow:function(item,$element){return!1},onDblClickRow:function(item,$element){return!1},onSort:function(name,order){return!1},onCheck:function(row){return!1},onUncheck:function(row){return!1},onCheckAll:function(rows){return!1},onUncheckAll:function(rows){return!1},onCheckSome:function(rows){return!1},onUncheckSome:function(rows){return!1},onLoadSuccess:function(data){return!1},onLoadError:function(status){return!1},onColumnSwitch:function(field,checked){return!1},onPageChange:function(number,size){return!1},onSearch:function(text){return!1},onToggle:function(cardView){return!1},onPreBody:function(data){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(index,row,$detail){return!1},onCollapseRow:function(index,row){return!1},onRefreshOptions:function(options){return!1},onRefresh:function(params){return!1},onResetView:function(){return!1}},(BootstrapTable.LOCALES={})["en-US"]=BootstrapTable.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(pageNumber){return sprintf("%s rows per page",pageNumber)},formatShowingRows:function(pageFrom,pageTo,totalRows){return sprintf("Showing %s to %s of %s rows",pageFrom,pageTo,totalRows)},formatDetailPagination:function(totalRows){return sprintf("Showing %s rows",totalRows)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},$.extend(BootstrapTable.DEFAULTS,BootstrapTable.LOCALES["en-US"]),BootstrapTable.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,class:void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},BootstrapTable.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},BootstrapTable.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},BootstrapTable.prototype.initLocale=function(){if(this.options.locale){var parts=this.options.locale.split(/-|_/);parts[0].toLowerCase(),parts[1]&&parts[1].toUpperCase(),$.fn.bootstrapTable.locales[this.options.locale]?$.extend(this.options,$.fn.bootstrapTable.locales[this.options.locale]):$.fn.bootstrapTable.locales[parts.join("-")]?$.extend(this.options,$.fn.bootstrapTable.locales[parts.join("-")]):$.fn.bootstrapTable.locales[parts[0]]&&$.extend(this.options,$.fn.bootstrapTable.locales[parts[0]])}},BootstrapTable.prototype.initContainer=function(){this.$container=$(['
','
',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'
':"",'
','
','
','
',this.options.formatLoadingMessage(),"
","
",'',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'
':"","
","
"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('
'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==$.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},BootstrapTable.prototype.initTable=function(){var that=this,columns=[],data=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=$("").appendTo(this.$el)),this.$header.find("tr").each(function(){var column=[];$(this).find("th").each(function(){void 0!==$(this).data("field")&&$(this).data("field",$(this).data("field")+""),column.push($.extend({},{title:$(this).html(),class:$(this).attr("class"),titleTooltip:$(this).attr("title"),rowspan:$(this).attr("rowspan")?+$(this).attr("rowspan"):void 0,colspan:$(this).attr("colspan")?+$(this).attr("colspan"):void 0},$(this).data()))}),columns.push(column)}),$.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=$.extend(!0,[],columns,this.options.columns),this.columns=[],setFieldIndex(this.options.columns),$.each(this.options.columns,function(i,columns){$.each(columns,function(j,column){void 0!==(column=$.extend({},BootstrapTable.COLUMN_DEFAULTS,column)).fieldIndex&&(that.columns[column.fieldIndex]=column),that.options.columns[i][j]=column})}),!this.options.data.length){var m=[];this.$el.find(">tbody>tr").each(function(y){var row={};row._id=$(this).attr("id"),row._class=$(this).attr("class"),row._data=getRealDataAttr($(this).data()),$(this).find(">td").each(function(x){for(var tx,ty,$this=$(this),cspan=+$this.attr("colspan")||1,rspan=+$this.attr("rowspan")||1;m[y]&&m[y][x];x++);for(tx=x;tx"),0===i&&!that.options.cardView&&that.options.detailView&&html.push(sprintf('
',that.options.columns.length)),$.each(columns,function(j,column){var text="",halign="",align="",style="",class_=sprintf(' class="%s"',column.class),unitWidth=(that.options.sortOrder||column.order,"px"),width=column.width;if(void 0===column.width||that.options.cardView||"string"==typeof column.width&&-1!==column.width.indexOf("%")&&(unitWidth="%"),column.width&&"string"==typeof column.width&&(width=column.width.replace("%","").replace("px","")),halign=sprintf("text-align: %s; ",column.halign?column.halign:column.align),align=sprintf("text-align: %s; ",column.align),style=sprintf("vertical-align: %s; ",column.valign),style+=sprintf("width: %s; ",!column.checkbox&&!column.radio||width?width?width+unitWidth:void 0:"36px"),void 0!==column.fieldIndex){if(that.header.fields[column.fieldIndex]=column.field,that.header.styles[column.fieldIndex]=align+style,that.header.classes[column.fieldIndex]=class_,that.header.formatters[column.fieldIndex]=column.formatter,that.header.events[column.fieldIndex]=column.events,that.header.sorters[column.fieldIndex]=column.sorter,that.header.sortNames[column.fieldIndex]=column.sortName,that.header.cellStyles[column.fieldIndex]=column.cellStyle,that.header.searchables[column.fieldIndex]=column.searchable,!column.visible)return;if(that.options.cardView&&!column.cardVisible)return;visibleColumns[column.field]=column}html.push(""),html.push(sprintf('
',that.options.sortable&&column.sortable?"sortable both":"")),text=that.options.escape?escapeHTML(column.title):column.title,column.checkbox&&(!that.options.singleSelect&&that.options.checkboxHeader&&(text=''),that.header.stateField=column.field),column.radio&&(text="",that.header.stateField=column.field,that.options.singleSelect=!0),html.push(text),html.push("
"),html.push('
'),html.push("
"),html.push("")}),html.push("")}),this.$header.html(html.join("")),this.$header.find("th[data-field]").each(function(i){$(this).data(visibleColumns[$(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(event){var target=$(this);if(that.options.detailView&&target.closest(".bootstrap-table")[0]!==that.$container[0])return!1;that.options.sortable&&target.parent().data().sortable&&that.onSort(event)}),this.$header.children().children().off("keypress").on("keypress",function(event){that.options.sortable&&$(this).data().sortable&&13==(event.keyCode||event.which)&&that.onSort(event)}),$(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),$(window).on("resize.bootstrap-table",$.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var checked=$(this).prop("checked");that[checked?"checkAll":"uncheckAll"](),that.updateSelected()})},BootstrapTable.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},BootstrapTable.prototype.initData=function(data,type){this.data="append"===type?this.data.concat(data):"prepend"===type?[].concat(data).concat(this.data):data||this.options.data,this.options.data="append"===type?this.options.data.concat(data):"prepend"===type?[].concat(data).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},BootstrapTable.prototype.initSort=function(){var that=this,name=this.options.sortName,order="desc"===this.options.sortOrder?-1:1,index=$.inArray(this.options.sortName,this.header.fields),timeoutId=0;this.options.customSort===$.noop?-1!==index&&(this.options.sortStable&&$.each(this.data,function(i,row){row.hasOwnProperty("_position")||(row._position=i)}),this.data.sort(function(a,b){that.header.sortNames[index]&&(name=that.header.sortNames[index]);var aa=getItemField(a,name,that.options.escape),bb=getItemField(b,name,that.options.escape),value=calculateObjectValue(that.header,that.header.sorters[index],[aa,bb]);return void 0!==value?order*value:(void 0!==aa&&null!==aa||(aa=""),void 0!==bb&&null!==bb||(bb=""),that.options.sortStable&&aa===bb&&(aa=a._position,bb=b._position),$.isNumeric(aa)&&$.isNumeric(bb)?(aa=parseFloat(aa),bb=parseFloat(bb),aa
',this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar)),html=[sprintf('
',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=calculateObjectValue(null,this.options.icons)),this.options.showPaginationSwitch&&html.push(sprintf('"),this.options.showRefresh&&html.push(sprintf('"),this.options.showToggle&&html.push(sprintf('"),this.options.showColumns&&(html.push(sprintf('
',this.options.formatColumns()),'",'","
")),html.push("
"),(this.showToolbar||html.length>2)&&this.$toolbar.append(html.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",$.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",$.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){that.toggleView()}),this.options.showColumns&&($keepOpen=this.$toolbar.find(".keep-open"),switchableCount<=this.options.minimumCountColumns&&$keepOpen.find("input").prop("disabled",!0),$keepOpen.find("li").off("click").on("click",function(event){event.stopImmediatePropagation()}),$keepOpen.find("input").off("click").on("click",function(){var $this=$(this);that.toggleColumn($(this).val(),$this.prop("checked"),!1),that.trigger("column-switch",$(this).data("field"),$this.prop("checked"))})),this.options.search&&((html=[]).push('"),this.$toolbar.append(html.join("")),($search=this.$toolbar.find(".search input")).off("keyup drop blur").on("keyup drop blur",function(event){that.options.searchOnEnterKey&&13!==event.keyCode||$.inArray(event.keyCode,[37,38,39,40])>-1||(clearTimeout(timeoutId),timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut))}),isIEBrowser()&&$search.off("mouseup").on("mouseup",function(event){clearTimeout(timeoutId),timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)}))},BootstrapTable.prototype.onSearch=function(event){var text=$.trim($(event.currentTarget).val());this.options.trimOnSearch&&$(event.currentTarget).val()!==text&&$(event.currentTarget).val(text),text===this.searchText||""===text&&void 0===this.searchText||(this.searchText=text,this.options.searchText=text,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",text))},BootstrapTable.prototype.initSearch=function(){var that=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==$.noop)return void this.options.customSearch.apply(this,[this.searchText]);var s=this.searchText&&(this.options.escape?escapeHTML(this.searchText):this.searchText).toLowerCase(),f=$.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=f?$.grep(this.options.data,function(item,i){for(var key in f)if($.isArray(f[key])&&-1===$.inArray(item[key],f[key])||!$.isArray(f[key])&&item[key]!==f[key])return!1;return!0}):this.options.data,this.data=s?$.grep(this.data,function(item,i){for(var j=0;j-1&&($allSelected=!0)}this.totalPages=1+~~((this.options.totalRows-1)/this.options.pageSize),this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),html.push('
','',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),""),!this.options.onlyInfoPagination){html.push('');var pageNumber=[sprintf('',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'",'"),html.push(this.options.formatRecordsPerPage(pageNumber.join(""))),html.push(""),html.push("
",'")}this.$pagination.html(html.join("")),this.options.onlyInfoPagination||($pageList=this.$pagination.find(".page-list a"),$first=this.$pagination.find(".page-first"),$pre=this.$pagination.find(".page-pre"),$next=this.$pagination.find(".page-next"),$last=this.$pagination.find(".page-last"),$number=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(pageList.length<2||this.options.totalRows<=pageList[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&$pre.addClass("disabled"),this.options.pageNumber===this.totalPages&&$next.addClass("disabled")),$allSelected&&(this.options.pageSize=this.options.formatAllRows()),$pageList.off("click").on("click",$.proxy(this.onPageListChange,this)),$first.off("click").on("click",$.proxy(this.onPageFirst,this)),$pre.off("click").on("click",$.proxy(this.onPagePre,this)),$next.off("click").on("click",$.proxy(this.onPageNext,this)),$last.off("click").on("click",$.proxy(this.onPageLast,this)),$number.off("click").on("click",$.proxy(this.onPageNumber,this)))}else this.$pagination.hide()},BootstrapTable.prototype.updatePagination=function(event){event&&$(event.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},BootstrapTable.prototype.onPageListChange=function(event){var $this=$(event.currentTarget);return $this.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=$this.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+$this.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(event),!1},BootstrapTable.prototype.onPageFirst=function(event){return this.options.pageNumber=1,this.updatePagination(event),!1},BootstrapTable.prototype.onPagePre=function(event){return this.options.pageNumber-1==0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(event),!1},BootstrapTable.prototype.onPageNext=function(event){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(event),!1},BootstrapTable.prototype.onPageLast=function(event){return this.options.pageNumber=this.totalPages,this.updatePagination(event),!1},BootstrapTable.prototype.onPageNumber=function(event){if(this.options.pageNumber!==+$(event.currentTarget).text())return this.options.pageNumber=+$(event.currentTarget).text(),this.updatePagination(event),!1},BootstrapTable.prototype.initRow=function(item,i,data,parentDom){var key,that=this,html=[],style={},csses=[],data_="",attributes={},htmlAttributes=[];if(!($.inArray(item,this.hiddenRows)>-1)){if((style=calculateObjectValue(this.options,this.options.rowStyle,[item,i],style))&&style.css)for(key in style.css)csses.push(key+": "+style.css[key]);if(attributes=calculateObjectValue(this.options,this.options.rowAttributes,[item,i],attributes))for(key in attributes)htmlAttributes.push(sprintf('%s="%s"',key,escapeHTML(attributes[key])));return item._data&&!$.isEmptyObject(item._data)&&$.each(item._data,function(k,v){"index"!==k&&(data_+=sprintf(' data-%s="%s"',k,v))}),html.push(""),this.options.cardView&&html.push(sprintf('
',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&html.push("",'',sprintf('',this.options.iconsPrefix,this.options.icons.detailOpen),"",""),$.each(this.header.fields,function(j,field){var text="",value_=getItemField(item,field,that.options.escape),value="",type="",cellStyle={},id_="",class_=that.header.classes[j],data_="",rowspan_="",colspan_="",title_="",column=that.columns[j];if((!that.fromHtml||void 0!==value_)&&column.visible&&(!that.options.cardView||column.cardVisible)){if(column.escape&&(value_=escapeHTML(value_)),style=sprintf('style="%s"',csses.concat(that.header.styles[j]).join("; ")),item["_"+field+"_id"]&&(id_=sprintf(' id="%s"',item["_"+field+"_id"])),item["_"+field+"_class"]&&(class_=sprintf(' class="%s"',item["_"+field+"_class"])),item["_"+field+"_rowspan"]&&(rowspan_=sprintf(' rowspan="%s"',item["_"+field+"_rowspan"])),item["_"+field+"_colspan"]&&(colspan_=sprintf(' colspan="%s"',item["_"+field+"_colspan"])),item["_"+field+"_title"]&&(title_=sprintf(' title="%s"',item["_"+field+"_title"])),(cellStyle=calculateObjectValue(that.header,that.header.cellStyles[j],[value_,item,i,field],cellStyle)).classes&&(class_=sprintf(' class="%s"',cellStyle.classes)),cellStyle.css){var csses_=[];for(var key in cellStyle.css)csses_.push(key+": "+cellStyle.css[key]);style=sprintf('style="%s"',csses_.concat(that.header.styles[j]).join("; "))}value=calculateObjectValue(column,that.header.formatters[j],[value_,item,i],value_),item["_"+field+"_data"]&&!$.isEmptyObject(item["_"+field+"_data"])&&$.each(item["_"+field+"_data"],function(k,v){"index"!==k&&(data_+=sprintf(' data-%s="%s"',k,v))}),column.checkbox||column.radio?(type=column.checkbox?"checkbox":type,type=column.radio?"radio":type,text=[sprintf(that.options.cardView?'
':'',column.class||""),"",that.header.formatters[j]&&"string"==typeof value?value:"",that.options.cardView?"
":""].join(""),item[that.header.stateField]=!0===value||value&&value.checked):(value=void 0===value||null===value?that.options.undefinedText:value,text=that.options.cardView?['
',that.options.showHeader?sprintf('%s',style,getPropertyFromOther(that.columns,"field","title",field)):"",sprintf('%s',value),"
"].join(""):[sprintf("",id_,class_,style,data_,rowspan_,colspan_,title_),value,""].join(""),that.options.cardView&&that.options.smartDisplay&&""===value&&(text='
')),html.push(text)}}),this.options.cardView&&html.push("
"),html.push(""),html.join(" ")}},BootstrapTable.prototype.initBody=function(fixedScroll){var that=this,data=this.getData();this.trigger("pre-body",data),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=$("").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=data.length);for(var hasTr,trFragments=$(document.createDocumentFragment()),i=this.pageFrom-1;i'+sprintf('%s',this.$header.find("th").length,this.options.formatNoMatches())+""),this.$body.html(trFragments),fixedScroll||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var $td=$(this),$tr=$td.parent(),item=that.data[$tr.data("index")],index=$td[0].cellIndex,field=that.getVisibleFields()[that.options.detailView&&!that.options.cardView?index-1:index],column=that.columns[getFieldIndex(that.columns,field)],value=getItemField(item,field,that.options.escape);if(!$td.find(".detail-icon").length&&(that.trigger("click"===e.type?"click-cell":"dbl-click-cell",field,value,item,$td),that.trigger("click"===e.type?"click-row":"dbl-click-row",item,$tr,field),"click"===e.type&&that.options.clickToSelect&&column.clickToSelect)){var $selectItem=$tr.find(sprintf('[name="%s"]',that.options.selectItemName));$selectItem.length&&$selectItem[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var $this=$(this),$tr=$this.parent().parent(),index=$tr.data("index"),row=data[index];if($tr.next().is("tr.detail-view"))$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailOpen)),that.trigger("collapse-row",index,row),$tr.next().remove();else{$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailClose)),$tr.after(sprintf('',$tr.find("td").length));var $element=$tr.next().find("td"),content=calculateObjectValue(that.options,that.options.detailFormatter,[index,row,$element],"");1===$element.length&&$element.append(content),that.trigger("expand-row",index,row,$element)}return that.resetView(),!1}),this.$selectItem=this.$body.find(sprintf('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(event){event.stopImmediatePropagation();var $this=$(this),checked=$this.prop("checked"),row=that.data[$this.data("index")];that.options.maintainSelected&&$(this).is(":radio")&&$.each(that.options.data,function(i,row){row[that.header.stateField]=!1}),row[that.header.stateField]=checked,that.options.singleSelect&&(that.$selectItem.not(this).each(function(){that.data[$(this).data("index")][that.header.stateField]=!1}),that.$selectItem.filter(":checked").not(this).prop("checked",!1)),that.updateSelected(),that.trigger(checked?"check":"uncheck",row,$this)}),$.each(this.header.events,function(i,events){if(events){"string"==typeof events&&(events=calculateObjectValue(null,events));var field=that.header.fields[i],fieldIndex=$.inArray(field,that.getVisibleFields());that.options.detailView&&!that.options.cardView&&(fieldIndex+=1);for(var key in events)that.$body.find(">tr:not(.no-records-found)").each(function(){var $tr=$(this),$td=$tr.find(that.options.cardView?".card-view":"td").eq(fieldIndex),index=key.indexOf(" "),name=key.substring(0,index),el=key.substring(index+1),func=events[key];$td.find(el).off(name).on(name,function(e){var index=$tr.data("index"),row=that.data[index],value=row[field],props=field.split(".");if(props.length>1){value=row;for(var prop_index=0;prop_indexfixedBody.clientWidth&&fixedBody.scrollHeight>fixedBody.clientHeight+this.$header.outerHeight()?getScrollBarWidth():0,this.$el.css("margin-top",-this.$header.outerHeight()),(focused=$(":focus")).length>0){var $th=focused.parents("th");if($th.length>0){var dataField=$th.attr("data-field");if(void 0!==dataField){var $headerTh=this.$header.find("[data-field='"+dataField+"']");$headerTh.length>0&&$headerTh.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":scrollWidth}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),(focusedTemp=$(".focus-temp:visible:eq(0)")).length>0&&(focusedTemp.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(i){that.$header_.find(sprintf('th[data-field="%s"]',$(this).data("field"))).data($(this).data())});var visibleFields=this.getVisibleFields(),$ths=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this),index=i;that.options.detailView&&!that.options.cardView&&(0===i&&that.$header_.find("th.detail").find(".fht-cell").width($this.innerWidth()),index=i-1);var $th=that.$header_.find(sprintf('th[data-field="%s"]',visibleFields[index]));$th.length>1&&($th=$($ths[$this[0].cellIndex])),$th.find(".fht-cell").width($this.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){that.$tableHeader.scrollLeft($(this).scrollLeft()),that.options.showFooter&&!that.options.cardView&&that.$tableFooter.scrollLeft($(this).scrollLeft())}),that.trigger("post-header")}},BootstrapTable.prototype.resetFooter=function(){var that=this,data=that.getData(),html=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&html.push('
 
'),$.each(this.columns,function(i,column){var key,falign="",valign="",csses=[],style={},class_=sprintf(' class="%s"',column.class);if(column.visible&&(!that.options.cardView||column.cardVisible)){if(falign=sprintf("text-align: %s; ",column.falign?column.falign:column.align),valign=sprintf("vertical-align: %s; ",column.valign),(style=calculateObjectValue(null,that.options.footerStyle))&&style.css)for(key in style.css)csses.push(key+": "+style.css[key]);html.push(""),html.push('
'),html.push(calculateObjectValue(column,column.footerFormatter,[data]," ")||" "),html.push("
"),html.push('
'),html.push("
"),html.push("")}}),this.$tableFooter.find("tr").html(html.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},BootstrapTable.prototype.fitFooter=function(){var $footerTd,elWidth,scrollWidth;clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),100):(scrollWidth=(elWidth=this.$el.css("width"))>this.$tableBody.width()?getScrollBarWidth():0,this.$tableFooter.css({"margin-right":scrollWidth}).find("table").css("width",elWidth).attr("class",this.$el.attr("class")),$footerTd=this.$tableFooter.find("td"),this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this);$footerTd.eq(i).find(".fht-cell").width($this.innerWidth())}))},BootstrapTable.prototype.toggleColumn=function(index,checked,needUpdate){if(-1!==index&&(this.columns[index].visible=checked,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var $items=this.$toolbar.find(".keep-open input").prop("disabled",!1);needUpdate&&$items.filter(sprintf('[value="%s"]',index)).prop("checked",checked),$items.filter(":checked").length<=this.options.minimumCountColumns&&$items.filter(":checked").prop("disabled",!0)}},BootstrapTable.prototype.getVisibleFields=function(){var that=this,visibleFields=[];return $.each(this.header.fields,function(j,field){that.columns[getFieldIndex(that.columns,field)].visible&&visibleFields.push(field)}),visibleFields},BootstrapTable.prototype.resetView=function(params){var padding=0;if(params&¶ms.height&&(this.options.height=params.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var toolbarHeight=this.$toolbar.outerHeight(!0),paginationHeight=this.$pagination.outerHeight(!0),height=this.options.height-toolbarHeight-paginationHeight;this.$tableContainer.css("height",height+"px")}if(this.options.cardView)return this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide();this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),padding+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(padding+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",padding+"px"),this.trigger("reset-view")},BootstrapTable.prototype.getData=function(useCurrentPage){return!this.searchText&&$.isEmptyObject(this.filterColumns)&&$.isEmptyObject(this.filterColumnsPartial)?useCurrentPage?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:useCurrentPage?this.data.slice(this.pageFrom-1,this.pageTo):this.data},BootstrapTable.prototype.load=function(data){var fixedScroll=!1;"server"===this.options.sidePagination?(this.options.totalRows=data[this.options.totalField],fixedScroll=data.fixedScroll,data=data[this.options.dataField]):$.isArray(data)||(fixedScroll=data.fixedScroll,data=data.data),this.initData(data),this.initSearch(),this.initPagination(),this.initBody(fixedScroll)},BootstrapTable.prototype.append=function(data){this.initData(data,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},BootstrapTable.prototype.prepend=function(data){this.initData(data,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},BootstrapTable.prototype.remove=function(params){var i,row,len=this.options.data.length;if(params.hasOwnProperty("field")&¶ms.hasOwnProperty("values")){for(i=len-1;i>=0;i--)(row=this.options.data[i]).hasOwnProperty(params.field)&&-1!==$.inArray(row[params.field],params.values)&&(this.options.data.splice(i,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));len!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},BootstrapTable.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},BootstrapTable.prototype.getRowByUniqueId=function(id){var i,row,rowUniqueId,uniqueId=this.options.uniqueId,dataRow=null;for(i=this.options.data.length-1;i>=0;i--){if((row=this.options.data[i]).hasOwnProperty(uniqueId))rowUniqueId=row[uniqueId];else{if(!row._data.hasOwnProperty(uniqueId))continue;rowUniqueId=row._data[uniqueId]}if("string"==typeof rowUniqueId?id=id.toString():"number"==typeof rowUniqueId&&(Number(rowUniqueId)===rowUniqueId&&rowUniqueId%1==0?id=parseInt(id):rowUniqueId===Number(rowUniqueId)&&0!==rowUniqueId&&(id=parseFloat(id))),rowUniqueId===id){dataRow=row;break}}return dataRow},BootstrapTable.prototype.removeByUniqueId=function(id){var len=this.options.data.length,row=this.getRowByUniqueId(id);row&&this.options.data.splice(this.options.data.indexOf(row),1),len!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},BootstrapTable.prototype.updateByUniqueId=function(params){var that=this,allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){var rowId;params.hasOwnProperty("id")&¶ms.hasOwnProperty("row")&&-1!==(rowId=$.inArray(that.getRowByUniqueId(params.id),that.options.data))&&$.extend(that.options.data[rowId],params.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},BootstrapTable.prototype.insertRow=function(params){params.hasOwnProperty("index")&¶ms.hasOwnProperty("row")&&(this.data.splice(params.index,0,params.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},BootstrapTable.prototype.updateRow=function(params){var that=this,allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){params.hasOwnProperty("index")&¶ms.hasOwnProperty("row")&&$.extend(that.options.data[params.index],params.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},BootstrapTable.prototype.initHiddenRows=function(){this.hiddenRows=[]},BootstrapTable.prototype.showRow=function(params){this.toggleRow(params,!0)},BootstrapTable.prototype.hideRow=function(params){this.toggleRow(params,!1)},BootstrapTable.prototype.toggleRow=function(params,visible){var row,index;params.hasOwnProperty("index")?row=this.getData()[params.index]:params.hasOwnProperty("uniqueId")&&(row=this.getRowByUniqueId(params.uniqueId)),row&&(index=$.inArray(row,this.hiddenRows),visible||-1!==index?visible&&index>-1&&this.hiddenRows.splice(index,1):this.hiddenRows.push(row),this.initBody(!0))},BootstrapTable.prototype.getHiddenRows=function(show){var that=this,data=this.getData(),rows=[];return $.each(data,function(i,row){$.inArray(row,that.hiddenRows)>-1&&rows.push(row)}),this.hiddenRows=rows,rows},BootstrapTable.prototype.mergeCells=function(options){var i,j,$td,row=options.index,col=$.inArray(options.field,this.getVisibleFields()),rowspan=options.rowspan||1,colspan=options.colspan||1,$tr=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(col+=1),$td=$tr.eq(row).find(">td").eq(col),!(row<0||col<0||row>=this.data.length)){for(i=row;itd").eq(j).hide();$td.attr("rowspan",rowspan).attr("colspan",colspan).show()}},BootstrapTable.prototype.updateCell=function(params){params.hasOwnProperty("index")&¶ms.hasOwnProperty("field")&¶ms.hasOwnProperty("value")&&(this.data[params.index][params.field]=params.value,!1!==params.reinit&&(this.initSort(),this.initBody(!0)))},BootstrapTable.prototype.getOptions=function(){return this.options},BootstrapTable.prototype.getSelections=function(){var that=this;return $.grep(this.options.data,function(row){return!0===row[that.header.stateField]})},BootstrapTable.prototype.getAllSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]})},BootstrapTable.prototype.checkAll=function(){this.checkAll_(!0)},BootstrapTable.prototype.uncheckAll=function(){this.checkAll_(!1)},BootstrapTable.prototype.checkInvert=function(){var that=this,rows=that.$selectItem.filter(":enabled"),checked=rows.filter(":checked");rows.each(function(){$(this).prop("checked",!$(this).prop("checked"))}),that.updateRows(),that.updateSelected(),that.trigger("uncheck-some",checked),checked=that.getSelections(),that.trigger("check-some",checked)},BootstrapTable.prototype.checkAll_=function(checked){var rows;checked||(rows=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",checked),this.$selectItem.filter(":enabled").prop("checked",checked),this.updateRows(),checked&&(rows=this.getSelections()),this.trigger(checked?"check-all":"uncheck-all",rows)},BootstrapTable.prototype.check=function(index){this.check_(!0,index)},BootstrapTable.prototype.uncheck=function(index){this.check_(!1,index)},BootstrapTable.prototype.check_=function(checked,index){var $el=this.$selectItem.filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);this.data[index][this.header.stateField]=checked,this.updateSelected(),this.trigger(checked?"check":"uncheck",this.data[index],$el)},BootstrapTable.prototype.checkBy=function(obj){this.checkBy_(!0,obj)},BootstrapTable.prototype.uncheckBy=function(obj){this.checkBy_(!1,obj)},BootstrapTable.prototype.checkBy_=function(checked,obj){if(obj.hasOwnProperty("field")&&obj.hasOwnProperty("values")){var that=this,rows=[];$.each(this.options.data,function(index,row){if(!row.hasOwnProperty(obj.field))return!1;if(-1!==$.inArray(row[obj.field],obj.values)){var $el=that.$selectItem.filter(":enabled").filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);row[that.header.stateField]=checked,rows.push(row),that.trigger(checked?"check":"uncheck",row,$el)}}),this.updateSelected(),this.trigger(checked?"check-some":"uncheck-some",rows)}},BootstrapTable.prototype.destroy=function(){this.$el.insertBefore(this.$container),$(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},BootstrapTable.prototype.showLoading=function(){this.$tableLoading.show()},BootstrapTable.prototype.hideLoading=function(){this.$tableLoading.hide()},BootstrapTable.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var button=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},BootstrapTable.prototype.refresh=function(params){params&¶ms.url&&(this.options.url=params.url),params&¶ms.pageNumber&&(this.options.pageNumber=params.pageNumber),params&¶ms.pageSize&&(this.options.pageSize=params.pageSize),this.initServer(params&¶ms.silent,params&¶ms.query,params&¶ms.url),this.trigger("refresh",params)},BootstrapTable.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},BootstrapTable.prototype.showColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),!0,!0)},BootstrapTable.prototype.hideColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),!1,!0)},BootstrapTable.prototype.getHiddenColumns=function(){return $.grep(this.columns,function(column){return!column.visible})},BootstrapTable.prototype.getVisibleColumns=function(){return $.grep(this.columns,function(column){return column.visible})},BootstrapTable.prototype.toggleAllColumns=function(visible){if($.each(this.columns,function(i,column){this.columns[i].visible=visible}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",!1);$items.filter(":checked").length<=this.options.minimumCountColumns&&$items.filter(":checked").prop("disabled",!0)}},BootstrapTable.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},BootstrapTable.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},BootstrapTable.prototype.filterBy=function(columns){this.filterColumns=$.isEmptyObject(columns)?{}:columns,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},BootstrapTable.prototype.scrollTo=function(value){if("string"==typeof value&&(value="bottom"===value?this.$tableBody[0].scrollHeight:0),"number"==typeof value&&this.$tableBody.scrollTop(value),void 0===value)return this.$tableBody.scrollTop()},BootstrapTable.prototype.getScrollPosition=function(){return this.scrollTo()},BootstrapTable.prototype.selectPage=function(page){page>0&&page<=this.options.totalPages&&(this.options.pageNumber=page,this.updatePagination())},BootstrapTable.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},BootstrapTable.prototype.nextPage=function(){this.options.pageNumber tr[data-index="%s"]',index));$tr.next().is("tr.detail-view")===!expand&&$tr.find("> td > .detail-icon").click()},BootstrapTable.prototype.expandRow=function(index){this.expandRow_(!0,index)},BootstrapTable.prototype.collapseRow=function(index){this.expandRow_(!1,index)},BootstrapTable.prototype.expandAllRows=function(isSubTable){if(isSubTable){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',0)),that=this,detailIcon=null,executeInterval=!1,idInterval=-1;if($tr.next().is("tr.detail-view")?$tr.next().next().is("tr.detail-view")||($tr.next().find(".detail-icon").click(),executeInterval=!0):($tr.find("> td > .detail-icon").click(),executeInterval=!0),executeInterval)try{idInterval=setInterval(function(){(detailIcon=that.$body.find("tr.detail-view").last().find(".detail-icon")).length>0?detailIcon.click():clearInterval(idInterval)},1)}catch(ex){clearInterval(idInterval)}}else for(var trs=this.$body.children(),i=0;i */ (function ($) { 'use strict'; $.fn.bootstrapTable.locales['zh-CN'] = { formatLoadingMessage: function () { return '正在努力地加载数据中,请稍候……'; }, formatRecordsPerPage: function (pageNumber) { return '每页显示 ' + pageNumber + ' 条记录'; }, formatShowingRows: function (pageFrom, pageTo, totalRows) { return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录'; }, formatSearch: function () { return '搜索'; }, formatNoMatches: function () { return '没有找到匹配的记录'; }, formatPaginationSwitch: function () { return '隐藏/显示分页'; }, formatRefresh: function () { return '刷新'; }, formatToggle: function () { return '切换'; }, formatColumns: function () { return '列'; }, formatExport: function () { return '导出数据'; }, formatClearFilters: function () { return '清空过滤'; } }; $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); })(jQuery); define("bootstrap-table-lang", ["bootstrap-table"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); /* tableExport.jquery.plugin Version 1.10.26 Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin Based on https://github.com/kayalshri/tableExport.jquery.plugin Licensed under the MIT License */ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,k,y){d instanceof String&&(d=String(d));for(var C=d.length,v=0;ve&&"undefined"!==typeof S[e]&&-1!==d.inArray(S[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,c,e,q,f){if("function"===typeof f){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(d(b),e));if(!1===h&& (0===a.ignoreRow.length||-1===d.inArray(e,a.ignoreRow)&&-1===d.inArray(e-q,a.ignoreRow))&&I(d(b))){b=v(d(b),c);var n=b.length,l=0,u=0;b.each(function(){var b=d(this),a=J(this),c=T(this),h;d.each(G,function(){if(e>this.s.r&&e<=this.e.r&&l>=this.s.c&&l<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)n++,u++,f(null,e,l++)});if(c||a)a=a||1,G.push({s:{r:e,c:l},e:{r:e+(c||1)-1,c:l+a-1}});!1===ta(b,n,u++)&&f(this,e,l++);if(1=this.s.r&&e<=this.e.r&& l>=this.s.c&&l<=this.e.c)for(ea=0;ea<=this.e.c-this.s.c;++ea)f(null,e,l++)})}}}function ua(b,a,e,d){if("undefined"!==typeof d.images&&(e=d.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var c=b.width/b.height,h=a.width/a.height,q=b.width,l=b.height,u=19.049976/25.4,g=0;h<=c?(l=Math.min(b.height,a.height),q=a.width*l/a.height):h>c&&(q=Math.min(b.width,a.width),l=a.height*q/a.width);q*=u;l*=u;lb.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(u.charAt(0))&&(k=u.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,q,f,h),u=u.substring(1,u.length)),g= e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;u.length&&q+g>b.textPos.x+b.width;)u=u.substring(0,u.length-1),g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize();e.doc.autoTableText(u,q,f,h);q+=g}if(n||l)d(c).is("b")?n=!1:d(c).is("i")&&(l=!1),e.doc.setFontType(n||l?n?"bold":"italic":"normal");c=c.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}} function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var c=a.date.pattern.exec(b);if(null==c)return!1;b=+c[a.date.match_y];if(0>b||8099]*)>)/gi,"\u2060"),p=d("
").html(m).contents();b=!1;m="";d.each(p.text().split("\u2028"),function(b,c){0b?1:0)).split(".");1===p.length&&(p[1]="");var t=3b?"-":"")+(a.numbers.output.thousandsSeparator?(t?p[0].substr(0,t)+a.numbers.output.thousandsSeparator: "")+p[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=l;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(n,c,e,f,h),n.data("teUserDefText",1))}void 0!==q&&(q.type=h);return f}function Ba(b){return 0h?f+=String.fromCharCode(h):(127h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}a=f}for(;q>2;n=(n&3)<<4|f>>4;var l=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?l=g=64:isNaN(b)&&(g=64);d=d+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return d}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p", unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml", onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageSize:"A4",pageOrientation:"portrait", styles:{header:{background:"#34495E",color:"#FFFFFF",bold:!0,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53, 595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39, 161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},B=this,ia=null,r=[],w=[],p=0,t="",S=[],G=[],Ea,K=[],V=!1;d.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&& (a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&& "undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var z=a.date.html.match(/[^a-zA-Z0-9]/)[0];z=a.date.html.toLowerCase().split(z);a.date.regex="^\\s*";a.date.regex+=k[z[0]];a.date.regex+="(.)";a.date.regex+=k[z[1]];a.date.regex+= "\\2";a.date.regex+=k[z[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=z.indexOf("dd")+1;a.date.match_d=k+(1"+D(a,d,e)+""});p++});Q+="";var Fa=1;w=C(d(B));d(w).each(function(){var a=1;t="";E(this,"td,th",p,r.length+w.length,function(b,d,g){t+=""+D(b,d,g)+"";a++});0"!==t&&(Q+=''+t+"",Fa++);p++});Q+="";if("string"===a.outputMode)return Q; if("base64"===a.outputMode)return L(Q);N(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],F=[];d(B).filter(function(){return I(d(this))}).each(function(){function b(a,b,c){var f=[];d(a).each(function(){var b=0,e=0;t="";E(this,"td,th",p,c+a.length,function(a,c,h){if(null!==a){var l="";c=D(a,c,h);h="String";if(!1!==jQuery.isNumeric(c))h="Number";else{var n=Ma(c);!1!==n&&(c=n,h="Number",l+=' ss:StyleID="pct1"')}"Number"!==h&&(c= c.replace(/\n/g,"
"));n=J(a);a=T(a);d.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||n)a=a||1,n=n||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+n-1}});1'+d("
").text(c).html()+"\r";e++}});0\r'+ t+"\r");p++});return a.length}var c=d(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(d("
").text(e).html());!1===a.exportHiddenCells&&(K=c.find("tr, th, td").filter(":hidden"),V=0\r";e=b(y(c),"th,td",0);b(C(c),"td,th",e);H+="\r";sa.push(H)});k={};z={};for(var m,aa,Y=0,ea=F.length;Y\r\r\r\r '+ (new Date).toISOString()+'\r\r\r \r\r\r 9000\r 13860\r 0\r 0\r False\r False\r\r\r \r \r \r\r'; for(z=0;z\r'+sa[z],k=a.mso.rtl?k+'\r\r\r':k+'\r',k+="\r";k+="\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"=== a.type&&"xlsx"===a.mso.fileFormat){var ba=[],Ga=XLSX.utils.book_new();d(B).filter(function(){return I(d(this))}).each(function(){for(var b=d(this),c={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],h,n=[],l=0,u=0,k,m,p,t,r,w=XLSX.SSF.get_table();lu;++l)if(k=e[l],m=!1,"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(d(k),l)),!0!==m&&(0===a.ignoreRow.length||-1===d.inArray(l,a.ignoreRow)&&-1===d.inArray(l-e.length,a.ignoreRow))&&!1!==I(d(k))){var y=k.children, B=0;for(k=0;kx||36x||48===x)A="n";else if("date"===C.type||13x||44x||56===x)A="d"}else A="s";if(null!=h)if(0===h.length)v.t="z";else if(0!==h.trim().length)if("s"===A)d(r).find("a").length&&(h="href"!==a.htmlHyperlink?h:"",v={f:'=HYPERLINK("'+d(r).find("a").attr("href")+(h.length?'","'+h:"")+'")'}); else if("function"===C.type)v={f:h};else if("TRUE"===h)v={t:"b",v:!0};else if("FALSE"===h)v={t:"b",v:!1};else if("n"===A||isFinite(Da(h,a.numbers.output))){if(r=Da(h,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(h))v={t:"n",v:isFinite(r)?r:h,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(h))||"d"===A)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?r: h,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};c[oa({c:m,r:u})]=v;g.e.c";r=y(b);d(r).each(function(){var b=d(this);t="";E(this,"th,td",p,r.length,function(d,c,f){if(null!==d){var e="";t+=""}});0"+t+"");p++});H+="";w=C(b);d(w).each(function(){var b=d(this);t="";E(this,"td,th",p,r.length+ w.length,function(c,g,f){if(null!==c){var e=D(c,g,f),n="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof a.mso.onMsoNumberFormat&&(l=a.mso.onMsoNumberFormat(c,g,f));"undefined"!==typeof l&&""!==l&&(n="style=\"mso-number-format:'"+l+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(c,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)l=g[a.mso.styles[k]],""===l&&(l=f[a.mso.styles[k]]),""!==l&&"0px none rgb(0, 0, 0)"!== l&&"rgba(0, 0, 0, 0)"!==l&&(n+=""===n?'style="':";",n+=a.mso.styles[k]+":"+l)}t+=""));t+=">"+e+""}});0"+t+"");p++});a.displayTableName&&(H+=""+D(d("

"+a.tableName+"

"))+"");H+=""});m=''+('')+"";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="",m+="",m+="",m+="",m+="",m+=ca,m+="",m+="",m+="",a.mso.rtl&&(m+=""),m+="",m+="",m+="",m+="",m+= "",m+="";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+O[a.mso.pageFormat][0]+"pt "+O[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}"; m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="";m+="";m+="";m+='
';m+=H;m+="
";m+="";m+="";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return L(m);N(m,a.fileName+"."+z,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(d(B)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length), g=new Uint8Array(d),f=0;fIa){a>O.a0[0]&&(ja="a0",da="l");for(var c in O)O.hasOwnProperty(c)&&O[c][1]>a&&(ja=c,da="l",O[c][0]>a&&(da="p"));Ia=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===da?"w":da}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(d(B).filter(function(){return I(d(this))}).each(function(){var b= 0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}}); "function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&& (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))wa(a,b,c)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&& !0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?Aa(a,{},g):(b=a.height/c.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,za(a,c.elements,g),a.textPos.y=b,Aa(a,c.elements,g)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,c,e,g)}return!1});g.headerrows=[];r=y(d(this));d(r).each(function(){b= 0;g.headerrows[p]=[];E(this,"th,td",p,r.length,function(a,c,d){var e=Ca(a);e.title=D(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0.btn-group"),a=n.find("div.export");if(!a.length){var p=(a=t(['
','",'","
"].join("")).appendTo(n)).find(".dropdown-menu"),l=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var r=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");l=[],t.each(r,function(t,o){l.push(o.slice(1,-1))})}t.each(l,function(t,o){e.hasOwnProperty(o)&&p.append(['
  • ','',e[o],"","
  • "].join(""))}),p.find("li").click(function(){var o=t(this).data("type"),e=function(){s.$el.tableExport(t.extend({},s.options.exportOptions,{type:o,escape:!1}))};if("all"===s.options.exportDataType&&s.options.pagination)s.$el.one("server"===s.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){e(),s.togglePagination()}),s.togglePagination();else if("selected"===s.options.exportDataType){var i=s.getData(),n=s.getAllSelections();if("server"===s.options.sidePagination){(i={total:s.options.totalRows})[s.options.dataField]=s.getData();var a="function"==typeof require?require("table"):null;(n={total:s.options.totalRows})[s.options.dataField]=a&&s.options.maintainSelected?a.api.selecteddata(s.$el):s.getAllSelections()}s.load(n),e(),s.load(i)}else e()})}}}}(jQuery); define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); (function(factory){if(typeof define==="function"&&define.amd){define('dropzone',["jquery"],factory)}else{factory(jQuery)}})(function(jQuery){var module={exports:{}};"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=callbacks[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var callback=_step.value;callback.apply(this,args)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator["return"]!=null){_iterator["return"]()}}finally{if(_didIteratorError){throw _iteratorError}}}}return this}},{key:"off",value:function off(event,fn){if(!this._callbacks||arguments.length===0){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks){return this}if(arguments.length===1){delete this._callbacks[event];return this}for(var i=0;i
    ');this.element.appendChild(messageElement)}var span=messageElement.getElementsByTagName("span")[0];if(span){if(span.textContent!=null){span.textContent=this.options.dictFallbackMessage}else if(span.innerText!=null){span.innerText=this.options.dictFallbackMessage}}return this.element.appendChild(this.getFallbackForm())},resize:function resize(file,width,height,resizeMethod){var info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};var srcRatio=file.width/file.height;if(width==null&&height==null){width=info.srcWidth;height=info.srcHeight}else if(width==null){width=height*srcRatio}else if(height==null){height=width/srcRatio}width=Math.min(width,info.srcWidth);height=Math.min(height,info.srcHeight);var trgRatio=width/height;if(info.srcWidth>width||info.srcHeight>height){if(resizeMethod==="crop"){if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio}}else if(resizeMethod==="contain"){if(srcRatio>trgRatio){height=width/srcRatio}else{width=height*srcRatio}}else{throw new Error("Unknown resizeMethod '".concat(resizeMethod,"'"))}}info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;info.trgWidth=width;info.trgHeight=height;return info},transformFile:function transformFile(file,done){if((this.options.resizeWidth||this.options.resizeHeight)&&file.type.match(/image.*/)){return this.resizeImage(file,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,done)}else{return done(file)}},previewTemplate:'
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n Check\n \n \n \n \n
    \n
    \n \n Error\n \n \n \n \n \n \n
    \n
    ',drop:function drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function dragstart(e){},dragend:function dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover:function dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave:function dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste:function paste(e){},reset:function reset(){return this.element.classList.remove("dz-started")},addedfile:function addedfile(file){var _this2=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started")}if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=file.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var node=_step3.value;node.textContent=file.name}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3["return"]!=null){_iterator3["return"]()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=file.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){node=_step4.value;node.innerHTML=this.filesize(file.size)}}catch(err){_didIteratorError4=true;_iteratorError4=err}finally{try{if(!_iteratorNormalCompletion4&&_iterator4["return"]!=null){_iterator4["return"]()}}finally{if(_didIteratorError4){throw _iteratorError4}}}if(this.options.addRemoveLinks){file._removeLink=Dropzone.createElement(''.concat(this.options.dictRemoveFile,""));file.previewElement.appendChild(file._removeLink)}var removeFileEvent=function removeFileEvent(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation,function(){return _this2.removeFile(file)})}else{if(_this2.options.dictRemoveFileConfirmation){return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation,function(){return _this2.removeFile(file)})}else{return _this2.removeFile(file)}}};var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=file.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var removeLink=_step5.value;removeLink.addEventListener("click",removeFileEvent)}}catch(err){_didIteratorError5=true;_iteratorError5=err}finally{try{if(!_iteratorNormalCompletion5&&_iterator5["return"]!=null){_iterator5["return"]()}}finally{if(_didIteratorError5){throw _iteratorError5}}}}},removedfile:function removedfile(file){if(file.previewElement!=null&&file.previewElement.parentNode!=null){file.previewElement.parentNode.removeChild(file.previewElement)}return this._updateMaxFilesReachedClass()},thumbnail:function thumbnail(file,dataUrl){if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=file.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var thumbnailElement=_step6.value;thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl}}catch(err){_didIteratorError6=true;_iteratorError6=err}finally{try{if(!_iteratorNormalCompletion6&&_iterator6["return"]!=null){_iterator6["return"]()}}finally{if(_didIteratorError6){throw _iteratorError6}}}return setTimeout(function(){return file.previewElement.classList.add("dz-image-preview")},1)}},error:function error(file,message){if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error}var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=file.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var node=_step7.value;node.textContent=message}}catch(err){_didIteratorError7=true;_iteratorError7=err}finally{try{if(!_iteratorNormalCompletion7&&_iterator7["return"]!=null){_iterator7["return"]()}}finally{if(_didIteratorError7){throw _iteratorError7}}}}},errormultiple:function errormultiple(){},processing:function processing(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");if(file._removeLink){return file._removeLink.innerHTML=this.options.dictCancelUpload}}},processingmultiple:function processingmultiple(){},uploadprogress:function uploadprogress(file,progress,bytesSent){if(file.previewElement){var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=file.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var node=_step8.value;node.nodeName==="PROGRESS"?node.value=progress:node.style.width="".concat(progress,"%")}}catch(err){_didIteratorError8=true;_iteratorError8=err}finally{try{if(!_iteratorNormalCompletion8&&_iterator8["return"]!=null){_iterator8["return"]()}}finally{if(_didIteratorError8){throw _iteratorError8}}}}},totaluploadprogress:function totaluploadprogress(){},sending:function sending(){},sendingmultiple:function sendingmultiple(){},success:function success(file){if(file.previewElement){return file.previewElement.classList.add("dz-success")}},successmultiple:function successmultiple(){},canceled:function canceled(file){return this.emit("error",file,this.options.dictUploadCanceled)},canceledmultiple:function canceledmultiple(){},complete:function complete(file){if(file._removeLink){file._removeLink.innerHTML=this.options.dictRemoveFile}if(file.previewElement){return file.previewElement.classList.add("dz-complete")}},completemultiple:function completemultiple(){},maxfilesexceeded:function maxfilesexceeded(){},maxfilesreached:function maxfilesreached(){},queuecomplete:function queuecomplete(){},addedfiles:function addedfiles(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false}},{key:"extend",value:function extend(target){for(var _len2=arguments.length,objects=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){objects[_key2-1]=arguments[_key2]}for(var _i=0,_objects=objects;_i<_objects.length;_i++){var object=_objects[_i];for(var key in object){var val=object[key];target[key]=val}}return target}}]);function Dropzone(el,options){var _this;_classCallCheck(this,Dropzone);_this=_possibleConstructorReturn(this,_getPrototypeOf(Dropzone).call(this));var fallback,left;_this.element=el;_this.version=Dropzone.version;_this.defaultOptions.previewTemplate=_this.defaultOptions.previewTemplate.replace(/\n*/g,"");_this.clickableElements=[];_this.listeners=[];_this.files=[];if(typeof _this.element==="string"){_this.element=document.querySelector(_this.element)}if(!_this.element||_this.element.nodeType==null){throw new Error("Invalid dropzone element.")}if(_this.element.dropzone){throw new Error("Dropzone already attached.")}Dropzone.instances.push(_assertThisInitialized(_this));_this.element.dropzone=_assertThisInitialized(_this);var elementOptions=(left=Dropzone.optionsForElement(_this.element))!=null?left:{};_this.options=Dropzone.extend({},_this.defaultOptions,elementOptions,options!=null?options:{});if(_this.options.forceFallback||!Dropzone.isBrowserSupported()){return _possibleConstructorReturn(_this,_this.options.fallback.call(_assertThisInitialized(_this)))}if(_this.options.url==null){_this.options.url=_this.element.getAttribute("action")}if(!_this.options.url){throw new Error("No URL provided.")}if(_this.options.acceptedFiles&&_this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.")}if(_this.options.uploadMultiple&&_this.options.chunking){throw new Error("You cannot set both: uploadMultiple and chunking.")}if(_this.options.acceptedMimeTypes){_this.options.acceptedFiles=_this.options.acceptedMimeTypes;delete _this.options.acceptedMimeTypes}if(_this.options.renameFilename!=null){_this.options.renameFile=function(file){return _this.options.renameFilename.call(_assertThisInitialized(_this),file.name,file)}}_this.options.method=typeof _this.options.method!=="function"?_this.options.method.toUpperCase():_this.options.method;if((fallback=_this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback)}if(_this.options.previewsContainer!==false){if(_this.options.previewsContainer){_this.previewsContainer=Dropzone.getElement(_this.options.previewsContainer,"previewsContainer")}else{_this.previewsContainer=_this.element}}if(_this.options.clickable){if(_this.options.clickable===true){_this.clickableElements=[_this.element]}else{_this.clickableElements=Dropzone.getElements(_this.options.clickable,"clickable")}}_this.init();return _this}_createClass(Dropzone,[{key:"getAcceptedFiles",value:function getAcceptedFiles(){return this.files.filter(function(file){return file.accepted}).map(function(file){return file})}},{key:"getRejectedFiles",value:function getRejectedFiles(){return this.files.filter(function(file){return!file.accepted}).map(function(file){return file})}},{key:"getFilesWithStatus",value:function getFilesWithStatus(status){return this.files.filter(function(file){return file.status===status}).map(function(file){return file})}},{key:"getQueuedFiles",value:function getQueuedFiles(){return this.getFilesWithStatus(Dropzone.QUEUED)}},{key:"getUploadingFiles",value:function getUploadingFiles(){return this.getFilesWithStatus(Dropzone.UPLOADING)}},{key:"getAddedFiles",value:function getAddedFiles(){return this.getFilesWithStatus(Dropzone.ADDED)}},{key:"getActiveFiles",value:function getActiveFiles(){return this.files.filter(function(file){return file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED}).map(function(file){return file})}},{key:"init",value:function init(){var _this3=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data")}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(Dropzone.createElement('
    ")))}if(this.clickableElements.length){var setupHiddenFileInput=function setupHiddenFileInput(){if(_this3.hiddenFileInput){_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput)}_this3.hiddenFileInput=document.createElement("input");_this3.hiddenFileInput.setAttribute("type","file");if(_this3.options.maxFiles===null||_this3.options.maxFiles>1){_this3.hiddenFileInput.setAttribute("multiple","multiple")}_this3.hiddenFileInput.className="dz-hidden-input";if(_this3.options.acceptedFiles!==null){_this3.hiddenFileInput.setAttribute("accept",_this3.options.acceptedFiles)}if(_this3.options.capture!==null){_this3.hiddenFileInput.setAttribute("capture",_this3.options.capture)}_this3.hiddenFileInput.style.visibility="hidden";_this3.hiddenFileInput.style.position="absolute";_this3.hiddenFileInput.style.top="0";_this3.hiddenFileInput.style.left="0";_this3.hiddenFileInput.style.height="0";_this3.hiddenFileInput.style.width="0";Dropzone.getElement(_this3.options.hiddenInputContainer,"hiddenInputContainer").appendChild(_this3.hiddenFileInput);return _this3.hiddenFileInput.addEventListener("change",function(){var files=_this3.hiddenFileInput.files;if(files.length){var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=files[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var file=_step9.value;_this3.addFile(file)}}catch(err){_didIteratorError9=true;_iteratorError9=err}finally{try{if(!_iteratorNormalCompletion9&&_iterator9["return"]!=null){_iterator9["return"]()}}finally{if(_didIteratorError9){throw _iteratorError9}}}}_this3.emit("addedfiles",files);return setupHiddenFileInput()})};setupHiddenFileInput()}this.URL=window.URL!==null?window.URL:window.webkitURL;var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=this.events[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){var eventName=_step10.value;this.on(eventName,this.options[eventName])}}catch(err){_didIteratorError10=true;_iteratorError10=err}finally{try{if(!_iteratorNormalCompletion10&&_iterator10["return"]!=null){_iterator10["return"]()}}finally{if(_didIteratorError10){throw _iteratorError10}}}this.on("uploadprogress",function(){return _this3.updateTotalUploadProgress()});this.on("removedfile",function(){return _this3.updateTotalUploadProgress()});this.on("canceled",function(file){return _this3.emit("complete",file)});this.on("complete",function(file){if(_this3.getAddedFiles().length===0&&_this3.getUploadingFiles().length===0&&_this3.getQueuedFiles().length===0){return setTimeout(function(){return _this3.emit("queuecomplete")},0)}});var containsFiles=function containsFiles(e){return e.dataTransfer.types&&e.dataTransfer.types.some(function(type){return type=="Files"})};var noPropagation=function noPropagation(e){if(!containsFiles(e))return;e.stopPropagation();if(e.preventDefault){return e.preventDefault()}else{return e.returnValue=false}};this.listeners=[{element:this.element,events:{dragstart:function dragstart(e){return _this3.emit("dragstart",e)},dragenter:function dragenter(e){noPropagation(e);return _this3.emit("dragenter",e)},dragover:function dragover(e){var efct;try{efct=e.dataTransfer.effectAllowed}catch(error){}e.dataTransfer.dropEffect="move"===efct||"linkMove"===efct?"move":"copy";noPropagation(e);return _this3.emit("dragover",e)},dragleave:function dragleave(e){return _this3.emit("dragleave",e)},drop:function drop(e){noPropagation(e);return _this3.drop(e)},dragend:function dragend(e){return _this3.emit("dragend",e)}}}];this.clickableElements.forEach(function(clickableElement){return _this3.listeners.push({element:clickableElement,events:{click:function click(evt){if(clickableElement!==_this3.element||evt.target===_this3.element||Dropzone.elementInside(evt.target,_this3.element.querySelector(".dz-message"))){_this3.hiddenFileInput.click()}return true}}})});this.enable();return this.options.init.call(this)}},{key:"destroy",value:function destroy(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null}delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function updateTotalUploadProgress(){var totalUploadProgress;var totalBytesSent=0;var totalBytes=0;var activeFiles=this.getActiveFiles();if(activeFiles.length){var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=this.getActiveFiles()[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var file=_step11.value;totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total}}catch(err){_didIteratorError11=true;_iteratorError11=err}finally{try{if(!_iteratorNormalCompletion11&&_iterator11["return"]!=null){_iterator11["return"]()}}finally{if(_didIteratorError11){throw _iteratorError11}}}totalUploadProgress=100*totalBytesSent/totalBytes}else{totalUploadProgress=100}return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent)}},{key:"_getParamName",value:function _getParamName(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n)}else{return"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(n,"]"):"")}}},{key:"_renameFile",value:function _renameFile(file){if(typeof this.options.renameFile!=="function"){return file.name}return this.options.renameFile(file)}},{key:"getFallbackForm",value:function getFallbackForm(){var existingFallback,form;if(existingFallback=this.getExistingFallback()){return existingFallback}var fieldsString='
    ';if(this.options.dictFallbackText){fieldsString+="

    ".concat(this.options.dictFallbackText,"

    ")}fieldsString+='
    ');var fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement('
    '));form.appendChild(fields)}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method)}return form!=null?form:fields}},{key:"getExistingFallback",value:function getExistingFallback(){var getFallback=function getFallback(elements){var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=elements[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var el=_step12.value;if(/(^| )fallback($| )/.test(el.className)){return el}}}catch(err){_didIteratorError12=true;_iteratorError12=err}finally{try{if(!_iteratorNormalCompletion12&&_iterator12["return"]!=null){_iterator12["return"]()}}finally{if(_didIteratorError12){throw _iteratorError12}}}};for(var _i2=0,_arr=["div","form"];_i2<_arr.length;_i2++){var tagName=_arr[_i2];var fallback;if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback}}}},{key:"setupEventListeners",value:function setupEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.addEventListener(event,listener,false))}return result}()})}},{key:"removeEventListeners",value:function removeEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.removeEventListener(event,listener,false))}return result}()})}},{key:"disable",value:function disable(){var _this4=this;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable")});this.removeEventListeners();this.disabled=true;return this.files.map(function(file){return _this4.cancelUpload(file)})}},{key:"enable",value:function enable(){delete this.disabled;this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable")});return this.setupEventListeners()}},{key:"filesize",value:function filesize(size){var selectedSize=0;var selectedUnit="b";if(size>0){var units=["tb","gb","mb","kb","b"];for(var i=0;i=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break}}selectedSize=Math.round(10*selectedSize)/10}return"".concat(selectedSize," ").concat(this.options.dictFileSizeUnits[selectedUnit])}},{key:"_updateMaxFilesReachedClass",value:function _updateMaxFilesReachedClass(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit("maxfilesreached",this.files)}return this.element.classList.add("dz-max-files-reached")}else{return this.element.classList.remove("dz-max-files-reached")}}},{key:"drop",value:function drop(e){if(!e.dataTransfer){return}this.emit("drop",e);var files=[];for(var i=0;i0){var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=entries[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var entry=_step15.value;if(entry.isFile){entry.file(function(file){if(_this6.options.ignoreHiddenFiles&&file.name.substring(0,1)==="."){return}file.fullPath="".concat(path,"/").concat(file.name);return _this6.addFile(file)})}else if(entry.isDirectory){_this6._addFilesFromDirectory(entry,"".concat(path,"/").concat(entry.name))}}}catch(err){_didIteratorError15=true;_iteratorError15=err}finally{try{if(!_iteratorNormalCompletion15&&_iterator15["return"]!=null){_iterator15["return"]()}}finally{if(_didIteratorError15){throw _iteratorError15}}}readEntries()}return null},errorHandler)};return readEntries()}},{key:"accept",value:function accept(file,done){if(this.options.maxFilesize&&file.size>this.options.maxFilesize*1024*1024){done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize))}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){done(this.options.dictInvalidFileType)}else if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));this.emit("maxfilesexceeded",file)}else{this.options.accept.call(this,file,done)}}},{key:"addFile",value:function addFile(file){var _this7=this;file.upload={uuid:Dropzone.uuidv4(),progress:0,total:file.size,bytesSent:0,filename:this._renameFile(file)};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);this._enqueueThumbnail(file);this.accept(file,function(error){if(error){file.accepted=false;_this7._errorProcessing([file],error)}else{file.accepted=true;if(_this7.options.autoQueue){_this7.enqueueFile(file)}}_this7._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function enqueueFiles(files){var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=files[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var file=_step16.value;this.enqueueFile(file)}}catch(err){_didIteratorError16=true;_iteratorError16=err}finally{try{if(!_iteratorNormalCompletion16&&_iterator16["return"]!=null){_iterator16["return"]()}}finally{if(_didIteratorError16){throw _iteratorError16}}}return null}},{key:"enqueueFile",value:function enqueueFile(file){var _this8=this;if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return _this8.processQueue()},0)}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.")}}},{key:"_enqueueThumbnail",value:function _enqueueThumbnail(file){var _this9=this;if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(function(){return _this9._processThumbnailQueue()},0)}}},{key:"_processThumbnailQueue",value:function _processThumbnailQueue(){var _this10=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return}this._processingThumbnail=true;var file=this._thumbnailQueue.shift();return this.createThumbnail(file,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(dataUrl){_this10.emit("thumbnail",file,dataUrl);_this10._processingThumbnail=false;return _this10._processThumbnailQueue()})}},{key:"removeFile",value:function removeFile(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file)}this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){return this.emit("reset")}}},{key:"removeAllFiles",value:function removeAllFiles(cancelIfNecessary){if(cancelIfNecessary==null){cancelIfNecessary=false}var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=this.files.slice()[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var file=_step17.value;if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file)}}}catch(err){_didIteratorError17=true;_iteratorError17=err}finally{try{if(!_iteratorNormalCompletion17&&_iterator17["return"]!=null){_iterator17["return"]()}}finally{if(_didIteratorError17){throw _iteratorError17}}}return null}},{key:"resizeImage",value:function resizeImage(file,width,height,resizeMethod,callback){var _this11=this;return this.createThumbnail(file,width,height,resizeMethod,true,function(dataUrl,canvas){if(canvas==null){return callback(file)}else{var resizeMimeType=_this11.options.resizeMimeType;if(resizeMimeType==null){resizeMimeType=file.type}var resizedDataURL=canvas.toDataURL(resizeMimeType,_this11.options.resizeQuality);if(resizeMimeType==="image/jpeg"||resizeMimeType==="image/jpg"){resizedDataURL=ExifRestore.restore(file.dataURL,resizedDataURL)}return callback(Dropzone.dataURItoBlob(resizedDataURL))}})}},{key:"createThumbnail",value:function createThumbnail(file,width,height,resizeMethod,fixOrientation,callback){var _this12=this;var fileReader=new FileReader;fileReader.onload=function(){file.dataURL=fileReader.result;if(file.type==="image/svg+xml"){if(callback!=null){callback(fileReader.result)}return}_this12.createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback)};fileReader.readAsDataURL(file)}},{key:"displayExistingFile",value:function displayExistingFile(mockFile,imageUrl,callback,crossOrigin){var _this13=this;var resizeThumbnail=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;this.emit("addedfile",mockFile);this.emit("complete",mockFile);if(!resizeThumbnail){this.emit("thumbnail",mockFile,imageUrl);if(callback)callback()}else{var onDone=function onDone(thumbnail){_this13.emit("thumbnail",mockFile,thumbnail);if(callback)callback()};mockFile.dataURL=imageUrl;this.createThumbnailFromUrl(mockFile,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.resizeMethod,this.options.fixOrientation,onDone,crossOrigin)}}},{key:"createThumbnailFromUrl",value:function createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback,crossOrigin){var _this14=this;var img=document.createElement("img");if(crossOrigin){img.crossOrigin=crossOrigin}img.onload=function(){var loadExif=function loadExif(callback){return callback(1)};if(typeof EXIF!=="undefined"&&EXIF!==null&&fixOrientation){loadExif=function loadExif(callback){return EXIF.getData(img,function(){return callback(EXIF.getTag(this,"Orientation"))})}}return loadExif(function(orientation){file.width=img.width;file.height=img.height;var resizeInfo=_this14.options.resize.call(_this14,file,width,height,resizeMethod);var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;if(orientation>4){canvas.width=resizeInfo.trgHeight;canvas.height=resizeInfo.trgWidth}switch(orientation){case 2:ctx.translate(canvas.width,0);ctx.scale(-1,1);break;case 3:ctx.translate(canvas.width,canvas.height);ctx.rotate(Math.PI);break;case 4:ctx.translate(0,canvas.height);ctx.scale(1,-1);break;case 5:ctx.rotate(.5*Math.PI);ctx.scale(1,-1);break;case 6:ctx.rotate(.5*Math.PI);ctx.translate(0,-canvas.width);break;case 7:ctx.rotate(.5*Math.PI);ctx.translate(canvas.height,-canvas.width);ctx.scale(-1,1);break;case 8:ctx.rotate(-.5*Math.PI);ctx.translate(-canvas.height,0);break}drawImageIOSFix(ctx,img,resizeInfo.srcX!=null?resizeInfo.srcX:0,resizeInfo.srcY!=null?resizeInfo.srcY:0,resizeInfo.srcWidth,resizeInfo.srcHeight,resizeInfo.trgX!=null?resizeInfo.trgX:0,resizeInfo.trgY!=null?resizeInfo.trgY:0,resizeInfo.trgWidth,resizeInfo.trgHeight);var thumbnail=canvas.toDataURL("image/png");if(callback!=null){return callback(thumbnail,canvas)}})};if(callback!=null){img.onerror=callback}return img.src=file.dataURL}},{key:"processQueue",value:function processQueue(){var parallelUploads=this.options.parallelUploads;var processingLength=this.getUploadingFiles().length;var i=processingLength;if(processingLength>=parallelUploads){return}var queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return}if(this.options.uploadMultiple){return this.processFiles(queuedFiles.slice(0,parallelUploads-processingLength))}else{while(i1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3]}return option.apply(this,args)}return option}},{key:"uploadFile",value:function uploadFile(file){return this.uploadFiles([file])}},{key:"uploadFiles",value:function uploadFiles(files){var _this15=this;this._transformFiles(files,function(transformedFiles){if(_this15.options.chunking){var transformedFile=transformedFiles[0];files[0].upload.chunked=_this15.options.chunking&&(_this15.options.forceChunking||transformedFile.size>_this15.options.chunkSize);files[0].upload.totalChunkCount=Math.ceil(transformedFile.size/_this15.options.chunkSize)}if(files[0].upload.chunked){var file=files[0];var _transformedFile=transformedFiles[0];var startedChunkCount=0;file.upload.chunks=[];var handleNextChunk=function handleNextChunk(){var chunkIndex=0;while(file.upload.chunks[chunkIndex]!==undefined){chunkIndex++}if(chunkIndex>=file.upload.totalChunkCount)return;startedChunkCount++;var start=chunkIndex*_this15.options.chunkSize;var end=Math.min(start+_this15.options.chunkSize,file.size);var dataBlock={name:_this15._getParamName(0),data:_transformedFile.webkitSlice?_transformedFile.webkitSlice(start,end):_transformedFile.slice(start,end),filename:file.upload.filename,chunkIndex:chunkIndex};file.upload.chunks[chunkIndex]={file:file,index:chunkIndex,dataBlock:dataBlock,status:Dropzone.UPLOADING,progress:0,retries:0};_this15._uploadData(files,[dataBlock])};file.upload.finishedChunkUpload=function(chunk,response){var allFinished=true;chunk.status=Dropzone.SUCCESS;_this15.options.chunkSuccess.call(_this15,chunk,file,response);chunk.dataBlock=null;chunk.xhr=null;for(var i=0;i=end;asc?i++:i--){ia[i]=byteString.charCodeAt(i)}return new Blob([ab],{type:mimeString})};var without=function without(list,rejectedItem){return list.filter(function(item){return item!==rejectedItem}).map(function(item){return item})};var camelize=function camelize(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase()})};Dropzone.createElement=function(string){var div=document.createElement("div");div.innerHTML=string;return div.childNodes[0]};Dropzone.elementInside=function(element,container){if(element===container){return true}while(element=element.parentNode){if(element===container){return true}}return false};Dropzone.getElement=function(el,name){var element;if(typeof el==="string"){element=document.querySelector(el)}else if(el.nodeType!=null){element=el}if(element==null){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector or a plain HTML element."))}return element};Dropzone.getElements=function(els,name){var el,elements;if(els instanceof Array){elements=[];try{var _iteratorNormalCompletion34=true;var _didIteratorError34=false;var _iteratorError34=undefined;try{for(var _iterator34=els[Symbol.iterator](),_step34;!(_iteratorNormalCompletion34=(_step34=_iterator34.next()).done);_iteratorNormalCompletion34=true){el=_step34.value;elements.push(this.getElement(el,name))}}catch(err){_didIteratorError34=true;_iteratorError34=err}finally{try{if(!_iteratorNormalCompletion34&&_iterator34["return"]!=null){_iterator34["return"]()}}finally{if(_didIteratorError34){throw _iteratorError34}}}}catch(e){elements=null}}else if(typeof els==="string"){elements=[];var _iteratorNormalCompletion35=true;var _didIteratorError35=false;var _iteratorError35=undefined;try{for(var _iterator35=document.querySelectorAll(els)[Symbol.iterator](),_step35;!(_iteratorNormalCompletion35=(_step35=_iterator35.next()).done);_iteratorNormalCompletion35=true){el=_step35.value;elements.push(el)}}catch(err){_didIteratorError35=true;_iteratorError35=err}finally{try{if(!_iteratorNormalCompletion35&&_iterator35["return"]!=null){_iterator35["return"]()}}finally{if(_didIteratorError35){throw _iteratorError35}}}}else if(els.nodeType!=null){elements=[els]}if(elements==null||!elements.length){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."))}return elements};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted()}else if(rejected!=null){return rejected()}};Dropzone.isValidFile=function(file,acceptedFiles){if(!acceptedFiles){return true}acceptedFiles=acceptedFiles.split(",");var mimeType=file.type;var baseMimeType=mimeType.replace(/\/.*$/,"");var _iteratorNormalCompletion36=true;var _didIteratorError36=false;var _iteratorError36=undefined;try{for(var _iterator36=acceptedFiles[Symbol.iterator](),_step36;!(_iteratorNormalCompletion36=(_step36=_iterator36.next()).done);_iteratorNormalCompletion36=true){var validType=_step36.value;validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true}}else{if(mimeType===validType){return true}}}}catch(err){_didIteratorError36=true;_iteratorError36=err}finally{try{if(!_iteratorNormalCompletion36&&_iterator36["return"]!=null){_iterator36["return"]()}}finally{if(_didIteratorError36){throw _iteratorError36}}}return false};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options)})}}if(typeof module!=="undefined"&&module!==null){module.exports=Dropzone}else{window.Dropzone=Dropzone}Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(img){var iw=img.naturalWidth;var ih=img.naturalHeight;var canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var _ctx$getImageData=ctx.getImageData(1,0,1,ih),data=_ctx$getImageData.data;var sy=0;var ey=ih;var py=ih;while(py>sy){var alpha=data[(py-1)*4+3];if(alpha===0){ey=py}else{sy=py}py=ey+sy>>1}var ratio=py/ih;if(ratio===0){return 1}else{return ratio}};var drawImageIOSFix=function drawImageIOSFix(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){var vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio)};var ExifRestore=function(){function ExifRestore(){_classCallCheck(this,ExifRestore)}_createClass(ExifRestore,null,[{key:"initClass",value:function initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function encode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;while(true){chr1=input[i++];chr2=input[i++];chr3=input[i++];enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+this.KEY_STR.charAt(enc1)+this.KEY_STR.charAt(enc2)+this.KEY_STR.charAt(enc3)+this.KEY_STR.charAt(enc4);chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(irawImageArray.length){break}}return segments}},{key:"decode64",value:function decode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;var buf=[];var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.")}input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(true){enc1=this.KEY_STR.indexOf(input.charAt(i++));enc2=this.KEY_STR.indexOf(input.charAt(i++));enc3=this.KEY_STR.indexOf(input.charAt(i++));enc4=this.KEY_STR.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;buf.push(chr1);if(enc3!==64){buf.push(chr2)}if(enc4!==64){buf.push(chr3)}chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(i\';this.onerror=null;" class="img-responsive">', }, events: { //初始化 onInit: function () { }, //上传成功的回调 onUploadSuccess: function (up, ret, file) { var button = up.element; var onUploadSuccess = up.options.onUploadSuccess; var data = typeof ret.data !== 'undefined' ? ret.data : null; //上传成功后回调 if (button) { //如果有文本框则填充 var input_id = $(button).data("input-id") ? $(button).data("input-id") : ""; if (input_id) { var urlArr = []; var inputObj = $("#" + input_id); if ($(button).data("multiple") && inputObj.val() !== "") { urlArr.push(inputObj.val()); } var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url; urlArr.push(url); inputObj.val(urlArr.join(",")).trigger("change").trigger("validate"); } //如果有回调函数 var onDomUploadSuccess = $(button).data("upload-success"); if (onDomUploadSuccess) { if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') { onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess]; } if (typeof onDomUploadSuccess === 'function') { var result = onDomUploadSuccess.call(button, data, ret); if (result === false) return; } } } if (typeof onUploadSuccess === 'function') { var result = onUploadSuccess.call(button, data, ret); if (result === false) return; } }, //上传错误的回调 onUploadError: function (up, ret, file) { var button = up.element; var onUploadError = up.options.onUploadError; var data = typeof ret.data !== 'undefined' ? ret.data : null; if (button) { var onDomUploadError = $(button).data("upload-error"); if (onDomUploadError) { if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') { onDomUploadError = Upload.api.custom[onDomUploadError]; } if (typeof onDomUploadError === 'function') { var result = onDomUploadError.call(button, data, ret); if (result === false) return; } } } if (typeof onUploadError === 'function') { var result = onUploadError.call(button, data, ret); if (result === false) { return; } } Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")"); }, //服务器响应数据后 onUploadResponse: function (response, up, file) { try { var ret = typeof response === 'object' ? response : JSON.parse(response); if (!ret.hasOwnProperty('code')) { $.extend(ret, {code: -2, msg: response, data: null}); } } catch (e) { var ret = {code: -1, msg: e.message, data: null}; } return ret; }, //上传全部结束后 onUploadComplete: function (up, files) { var button = up.element; var onUploadComplete = up.options.onUploadComplete; if (button) { var onDomUploadComplete = $(button).data("upload-complete"); if (onDomUploadComplete) { if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') { onDomUploadComplete = Upload.api.custom[onDomUploadComplete]; } if (typeof onDomUploadComplete === 'function') { var result = onDomUploadComplete.call(button, files); if (result === false) return; } } } if (typeof onUploadComplete === 'function') { var result = onUploadComplete.call(button, files); if (result === false) { return; } } } }, api: { //上传接口 upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) { element = typeof element === 'undefined' ? Upload.config.classname : element; $(element, Upload.config.container).each(function () { if ($(this).attr("initialized")) { return true; } $(this).attr("initialized", true); var that = this; var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4(); var url = $(this).data("url"); var maxsize = $(this).data("maxsize"); var maxcount = $(this).data("maxcount"); var mimetype = $(this).data("mimetype"); var multipart = $(this).data("multipart"); var multiple = $(this).data("multiple"); //填充ID var input_id = $(that).data("input-id") ? $(that).data("input-id") : ""; //预览ID var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : ""; //上传URL url = url ? url : Config.upload.uploadurl; url = Fast.api.fixurl(url); var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000; //最大可上传文件大小 maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize; //文件类型 mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype; //请求的表单参数 multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart; //是否支持批量上传 multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple; //后缀特殊处理 mimetype = mimetype.split(",").map(function (k) { return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k); }).join(","); mimetype = mimetype === '*' ? null : mimetype; //最大文件限制转换成mb var maxFilesize = (function (maxsize) { var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/); var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize), unit = matches ? matches[2].toLowerCase() : 'b'; var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4}; var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0; var bytes = size * Math.pow(1024, y); return bytes / Math.pow(1024, 2); }(maxsize)); var options = $(this).data() || {}; options = $.extend(true, {}, options, $(this).data("upload-options") || {}); delete options.success; delete options.url; multipart = $.isArray(multipart) ? {} : multipart; var params = $(this).data("params") || {}; var category = typeof params.category !== 'undefined' ? params.category : ($(this).data("category") || ''); if (category) { // multipart.category = category; } Upload.list[id] = new Dropzone(this, $.extend({ url: url, params: function (files, xhr, chunk) { var params = multipart; if (chunk) { return $.extend({}, params, { filesize: chunk.file.size, filename: chunk.file.name, chunkid: chunk.file.upload.uuid, chunkindex: chunk.index, chunkcount: chunk.file.upload.totalChunkCount, chunksize: this.options.chunkSize, chunkfilesize: chunk.dataBlock.data.size, width: chunk.file.width || 0, height: chunk.file.height || 0, type: chunk.file.type, }); } return params; }, chunking: chunking, chunkSize: chunkSize, maxFilesize: maxFilesize, acceptedFiles: mimetype, maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)), timeout: timeout, parallelUploads: 1, previewsContainer: false, dictDefaultMessage: __("Drop files here to upload"), dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"), dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"), dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"), dictInvalidFileType: __("You can't upload files of this type"), dictResponseError: __("Server responded with %s code.", "{{statusCode}}"), dictCancelUpload: __("Cancel upload"), dictUploadCanceled: __("Upload canceled"), dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"), dictRemoveFile: __("Remove file"), dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"), init: function () { Upload.events.onInit.call(this); //必须添加dz-message,否则点击icon无法唤起上传窗口 $(">i", this.element).addClass("dz-message"); this.options.elementHtml = $(this.element).html(); }, sending: function (file, xhr, formData) { if (typeof file.category !== 'undefined') { formData.append('category', file.category); } }, addedfile: function (file) { var params = $(this.element).data("params") || {}; var category = typeof params.category !== 'undefined' ? params.category : ($(this.element).data("category") || ''); file.category = typeof category === 'function' ? category.call(this, file) : category; }, addedfiles: function (files) { if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) { var inputObj = $("#" + this.options.inputId); if (inputObj.length > 0) { var value = $.trim(inputObj.val()); var nums = value === '' ? 0 : value.split(/\,/).length; var remain = this.options.maxFiles - nums; if (remain === 0 || files.length > remain) { files = Array.prototype.slice.call(files, remain); for (var i = 0; i < files.length; i++) { this.removeFile(files[i]); } Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles)); } } } }, success: function (file, response) { var ret = Upload.events.onUploadResponse(response, this, file); file.ret = ret; if (ret.code === 1) { Upload.events.onUploadSuccess(this, ret, file); } else { Upload.events.onUploadError(this, ret, file); } }, error: function (file, response, xhr) { var responseObj = $("
    " + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "
    "); responseObj.find("style, title, script").remove(); var msg = responseObj.text() || __('Network error'); var ret = {code: 0, data: null, msg: msg}; Upload.events.onUploadError(this, ret, file); }, uploadprogress: function (file, progress, bytesSent) { if (file.upload.chunked) { $(this.element).prop("disabled", true).html(" " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%"); } }, totaluploadprogress: function (progress, bytesSent) { if (this.getActiveFiles().length > 0 && !this.options.chunking) { $(this.element).prop("disabled", true).html(" " + __('Upload') + Math.floor(progress) + "%"); } }, queuecomplete: function () { Upload.events.onUploadComplete(this, this.files); this.removeAllFiles(true); $(this.element).prop("disabled", false).html(this.options.elementHtml); }, chunkSuccess: function (chunk, file, response) { }, chunksUploaded: function (file, done) { var that = this; Fast.api.ajax({ url: this.options.url, data: $.extend({}, multipart, { action: 'merge', filesize: file.size, filename: file.name, chunkid: file.upload.uuid, chunkcount: file.upload.totalChunkCount, }) }, function (data, ret) { done(JSON.stringify(ret)); return false; }, function (data, ret) { file.accepted = false; that._errorProcessing([file], ret.msg); }); }, onUploadSuccess: onUploadSuccess, onUploadError: onUploadError, onUploadComplete: onUploadComplete, }, Upload.options, options)); //拖动排序 if (preview_id && multiple) { require(['dragsort'], function () { $("#" + preview_id).dragsort({ dragSelector: "li a:not(.btn-trash)", dragEnd: function () { $("#" + preview_id).trigger("fa.preview.change"); }, placeHolderTemplate: '
  • ' }); }); } //刷新隐藏textarea的值 var refresh = function (name) { var data = {}; var textarea = $("textarea[name='" + name + "']"); var container = textarea.prev("ul"); $.each($("input,select,textarea", container).serializeArray(), function (i, j) { var reg = /\[?(\w+)\]?\[(\w+)\]$/g; var match = reg.exec(j.name); if (!match) return true; if (!isNaN(match[2])) { data[i] = j.value; } else { match[1] = "x" + parseInt(match[1]); if (typeof data[match[1]] === 'undefined') { data[match[1]] = {}; } data[match[1]][match[2]] = j.value; } }); var result = []; $.each(data, function (i, j) { result.push(j); }); textarea.val(JSON.stringify(result)); }; if (preview_id && input_id) { $(document.body).on("keyup change", "#" + input_id, function (e) { var inputStr = $("#" + input_id).val(); var inputArr = inputStr.split(/\,/); $("#" + preview_id).empty(); var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : ""; var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}"; var json = {}; try { json = JSON.parse(extend); } catch (e) { } $.each(inputArr, function (i, j) { if (!j) { return true; } var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j); suffix = suffix ? suffix[1] : 'file'; j = Config.upload.fullmode ? Fast.api.cdnurl(j) : j; var value = (json && typeof json[i] !== 'undefined' ? json[i] : null); var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix}; var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data); $("#" + preview_id).append(html); }); refresh($("#" + preview_id).data("name")); }); $("#" + input_id).trigger("change"); } if (preview_id) { //监听文本框改变事件 $("#" + preview_id).on('change keyup', "input,textarea,select", function () { refresh($(this).closest("ul").data("name")); }); // 监听事件 $(document.body).on("fa.preview.change", "#" + preview_id, function () { var urlArr = []; $("#" + preview_id + " [data-url]").each(function (i, j) { urlArr.push($(this).data("url")); }); if (input_id) { $("#" + input_id).val(urlArr.join(",")); } refresh($("#" + preview_id).data("name")); }); // 移除按钮事件 $(document.body).on("click", "#" + preview_id + " .btn-trash", function () { $(this).closest("li").remove(); $("#" + preview_id).trigger("fa.preview.change"); }); } if (input_id) { //粘贴上传、拖拽上传 $("body").on('paste drop', "#" + input_id, function (event) { var originEvent = event.originalEvent; var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']"); if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) { var items = originEvent.clipboardData.items; if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) { } else { Upload.list[button.attr("id")].paste(originEvent); return false; } } if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) { Upload.list[button.attr("id")].drop(originEvent); return false; } }); } }); }, /** * @deprecated Use upload instead. */ plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) { return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete); }, /** * @deprecated Use upload instead. */ faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) { return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete); }, // AJAX异步上传 send: function (file, onUploadSuccess, onUploadError, onUploadComplete) { var index = Layer.msg(__('Uploading'), {offset: 't', time: 0}); var id = "dropzone-" + Dropzone.uuidv4(); $(' ', searchSubmit)); htmlBtn.push(sprintf(' ', searchReset)); htmlBtn.push('
    '); return htmlBtn; }; var createOptionList = function (searchList, vObjCol, that) { var isArray = searchList.constructor === Array; var optionList = []; optionList.push(sprintf('', that.options.formatCommonChoose())); $.each(searchList, function (key, value) { if (value.constructor === Object) { key = value.id; value = value.name; } else { key = isArray ? value : key; } optionList.push(sprintf("", key == vObjCol.defaultValue ? 'selected' : '')); }); return optionList; }; var isSearchAvailble = function (that) { //只支持服务端搜索 if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) { return false; } return true; }; var getSearchQuery = function (that, removeempty) { var op = {}; var filter = {}; var value = ''; $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) { var name = $(this).data("name"); var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase(); var obj = $("[name='" + name + "']", that.$commonsearch); if (obj.length == 0) return true; var vObjCol = ColumnsForSearch[i]; var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null; if (obj.length > 1) { if (/BETWEEN$/.test(sym)) { var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()), value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val()); if (value_begin.length || value_end.length) { if (process) { value_begin = process(value_begin, 'begin'); value_end = process(value_end, 'end'); } value = value_begin + ',' + value_end; } else { value = ''; } //如果是时间筛选,将operate置为RANGE if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) { sym = 'RANGE'; } } else { value = $("[name='" + name + "']:checked", that.$commonsearch).val(); value = process ? process(value) : value; } } else { value = process ? process(obj.val()) : obj.val(); } if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) { return true; } op[name] = sym; filter[name] = value; }); return {op: op, filter: filter}; }; var getQueryParams = function (params, searchQuery, removeempty) { params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {}); params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {}); params.filter = $.extend({}, params.filter, searchQuery.filter); params.op = $.extend({}, params.op, searchQuery.op); //移除empty的值 if (removeempty) { $.each(params.filter, function (i, j) { if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) { delete params.filter[i]; delete params.op[i]; } }); } params.filter = JSON.stringify(params.filter); params.op = JSON.stringify(params.op); return params; }; $.extend($.fn.bootstrapTable.defaults, { commonSearch: false, titleForm: "Common search", actionForm: "", searchFormTemplate: "", searchFormVisible: true, searchClass: 'searchit', showSearch: true, renderDefault: true, onCommonSearch: function (field, text) { return false; }, onPostCommonSearch: function (table) { return false; } }); $.extend($.fn.bootstrapTable.defaults.icons, { commonSearchIcon: 'glyphicon-search' }); $.extend($.fn.bootstrapTable.Constructor.EVENTS, { 'common-search.bs.table': 'onCommonSearch', 'post-common-search.bs.table': 'onPostCommonSearch' }); $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], { formatCommonSearch: function () { return "Common search"; }, formatCommonSubmitButton: function () { return "Submit"; }, formatCommonResetButton: function () { return "Reset"; }, formatCommonCloseButton: function () { return "Close"; }, formatCommonChoose: function () { return "Choose"; } }); $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales); var BootstrapTable = $.fn.bootstrapTable.Constructor, _initHeader = BootstrapTable.prototype.initHeader, _initToolbar = BootstrapTable.prototype.initToolbar, _load = BootstrapTable.prototype.load, _initSearch = BootstrapTable.prototype.initSearch; BootstrapTable.prototype.initHeader = function () { _initHeader.apply(this, Array.prototype.slice.apply(arguments)); this.$header.find('th[data-field]').each(function (i) { var column = $(this).data(); if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) { $(".th-inner", this).outerWidth(column['width']); $(this).css("max-width", column['width']); } }); this.options.stateField = this.header.stateField; }; BootstrapTable.prototype.initToolbar = function () { _initToolbar.apply(this, Array.prototype.slice.apply(arguments)); if (!isSearchAvailble(this)) { return; } var that = this, html = []; if (that.options.showSearch) { html.push(sprintf('
    ', this.options.buttonsAlign, this.options.buttonsAlign)); html.push(sprintf('
    '); } if (that.$toolbar.find(".pull-right").length > 0) { $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first")); } else { that.$toolbar.append(html.join('')); } initCommonSearch(that.columns, that); that.$toolbar.find('button[name="commonSearch"]') .off('click').on('click', function () { that.$commonsearch.toggleClass("hidden"); return; }); that.$container.on("click", "." + that.options.searchClass, function () { var value = $(this).data("value"); var field = $(this).data("field"); var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']"); if (ul.length > 0) { $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click'); return; } var obj = $("form [name='" + field + "']", that.$commonsearch); if (obj.length > 0) { if (obj.is("select")) { $("option[value='" + value + "']", obj).prop("selected", true); } else if (obj.length > 1) { $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); } else { obj.val(value + ""); } obj.trigger("change"); $("form", that.$commonsearch).trigger("submit"); } }); var queryParams = that.options.queryParams; //匹配默认搜索值 this.options.queryParams = function (params) { return queryParams(getQueryParams(params, getSearchQuery(that, true))); }; this.trigger('post-common-search', that); }; BootstrapTable.prototype.onCommonSearch = function () { var searchQuery = getSearchQuery(this); this.trigger('common-search', this, searchQuery); this.options.pageNumber = 1; //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize; this.refresh({}); }; BootstrapTable.prototype.load = function (data) { _load.apply(this, Array.prototype.slice.apply(arguments)); if (!isSearchAvailble(this)) { return; } }; BootstrapTable.prototype.initSearch = function () { _initSearch.apply(this, Array.prototype.slice.apply(arguments)); if (!isSearchAvailble(this)) { return; } var that = this; var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial; this.data = fp ? $.grep(this.data, function (item, i) { for (var key in fp) { var fval = fp[key].toLowerCase(); var value = item[key]; value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value); if (!($.inArray(key, that.header.fields) !== -1 && (typeof value === 'string' || typeof value === 'number') && (value + '').toLowerCase().indexOf(fval) !== -1)) { return false; } } return true; }) : this.data; }; }(jQuery); define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); /** * 将BootstrapTable的行使用自定义的模板来渲染 * * @author: karson * @version: v0.0.1 * * @update 2017-06-24 */ !function ($) { 'use strict'; $.extend($.fn.bootstrapTable.defaults, { //是否启用模板渲染 templateView: false, //数据格式化的模板ID或格式函数 templateFormatter: "itemtpl", //添加的父类的class templateParentClass: "row row-flex", //向table添加的class templateTableClass: "table-template", }); var BootstrapTable = $.fn.bootstrapTable.Constructor, _initContainer = BootstrapTable.prototype.initContainer, _initBody = BootstrapTable.prototype.initBody, _initRow = BootstrapTable.prototype.initRow; BootstrapTable.prototype.initContainer = function () { _initContainer.apply(this, Array.prototype.slice.apply(arguments)); var that = this; if (!that.options.templateView) { return; } that.options.cardView = true; }; BootstrapTable.prototype.initBody = function () { var that = this; $.extend(that.options, { showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false, showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false, }); $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView); _initBody.apply(this, Array.prototype.slice.apply(arguments)); if (!that.options.templateView) { return; } else { //由于Bootstrap是基于Table的,添加一个父类容器 $("> *:not(.no-records-found)", that.$body).wrapAll($("
    ").addClass(that.options.templateParentClass)); } }; BootstrapTable.prototype.initRow = function (item, i, data, parentDom) { var that = this; //如果未启用则使用原生的initRow方法 if (!that.options.templateView) { return _initRow.apply(that, Array.prototype.slice.apply(arguments)); } var $content = ''; if (typeof that.options.templateFormatter === 'function') { $content = that.options.templateFormatter.call(that, item, i, data); } else { var Template = require('template'); $content = Template(that.options.templateFormatter, {item: item, i: i, data: data}); } return $content; }; }(jQuery); define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); /** * @author Jay */ (function ($) { 'use strict'; var sprintf = $.fn.bootstrapTable.utils.sprintf; $.extend($.fn.bootstrapTable.defaults, { showJumpto: false, exportOptions: {} }); $.extend($.fn.bootstrapTable.locales, { formatJumpto: function () { return 'GO'; } }); $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales); var BootstrapTable = $.fn.bootstrapTable.Constructor, _initPagination = BootstrapTable.prototype.initPagination; BootstrapTable.prototype.initPagination = function () { this.showToolbar = this.options.showExport; _initPagination.apply(this, Array.prototype.slice.apply(arguments)); if (this.options.showJumpto) { var that = this, $pageGroup = this.$pagination.find('ul.pagination'), $jumpto = $pageGroup.find('li.jumpto'); if (!$jumpto.length) { $jumpto = $([ '
  • ', '', '', '
  • '].join('')).appendTo($pageGroup); $jumpto.find('button').click(function () { that.selectPage(parseInt($jumpto.find('input').val())); }); } } }; })(jQuery); define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); (function ($) { 'use strict'; // Reasonable defaults var PIXEL_STEP = 10; var LINE_HEIGHT = 40; var PAGE_HEIGHT = 800; function normalizeWheel(event) { var sX = 0; // spinX var sY = 0; // spinY var pX = 0; // pixelX var pY = 0; // pixelY // Legacy if ('detail' in event) { sY = event.detail; } if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in event) { pY = event.deltaY; } if ('deltaX' in event) { pX = event.deltaX; } if ((pX || pY) && event.deltaMode) { if (event.deltaMode === 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; } var cachedWidth = null; var getScrollBarWidth = function getScrollBarWidth() { if (cachedWidth === null) { var inner = $('

    ').addClass('fixed-table-scroll-inner'), outer = $('

    ').addClass('fixed-table-scroll-outer'), w1 = void 0, w2 = void 0; outer.append(inner); $('body').append(outer); w1 = inner[0].offsetWidth; outer.css('overflow', 'scroll'); w2 = inner[0].offsetWidth; if (w1 === w2) { w2 = outer[0].clientWidth; } outer.remove(); cachedWidth = w1 - w2; } return cachedWidth; }; //获取原本表格体的滑块宽度 var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) { return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0; }; $.extend($.fn.bootstrapTable.defaults, { fixedColumns: false, fixedNumber: 0, fixedRightNumber: 0 }); var BootstrapTable = $.fn.bootstrapTable.Constructor, _initBody = BootstrapTable.prototype.initBody, _initContainer = BootstrapTable.prototype.initContainer, _trigger = BootstrapTable.prototype.trigger, _hideLoading = BootstrapTable.prototype.hideLoading, _updateSelected = BootstrapTable.prototype.updateSelected; BootstrapTable.prototype.fixedColumnsSupported = function () { var that = this; return that.options.fixedColumns && !that.options.detailView && !that.options.cardView; }; BootstrapTable.prototype.initFixedContainer = function () { if (!this.fixedColumnsSupported()) { return; } if (this.options.fixedNumber) { this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('
    '); this.$fixedColumns = this.$tableContainer.find('.fixed-columns'); } if (this.options.fixedRightNumber) { this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('
    '); this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right'); } }; BootstrapTable.prototype.initContainer = function () { _initContainer.apply(this, Array.prototype.slice.apply(arguments)); this.initFixedContainer(); }; BootstrapTable.prototype.initBody = function () { _initBody.apply(this, Array.prototype.slice.apply(arguments)); if (!this.fixedColumnsSupported()) { return; } if (this.options.showHeader && this.options.height) { return; } this.initFixedColumnsBody(); this.initFixedColumnsEvents(); }; BootstrapTable.prototype.trigger = function () { var that = this; _trigger.apply(this, Array.prototype.slice.apply(arguments)); if (arguments[0] === 'pre-body') { //如果上来就是cardView 设置表格高度为auto if (this.options.cardView) { this.$tableBody.css("height", "auto"); } } //监听cardView 显示/隐藏fixed部分 if (arguments[0] === 'toggle') { if (arguments[1]) { this.$tableBody.css("height", "auto"); this.$fixedColumns && this.$fixedColumns.hide(); this.$fixedColumnsRight && this.$fixedColumnsRight.hide(); } else { this.$tableBody.css("height", "100%"); this.$fixedColumns && this.$fixedColumns.show(); this.$fixedColumnsRight && this.$fixedColumnsRight.show(); this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width()); this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width()); } } if (!that.fixedColumnsSupported()) { return; } if (arguments[0] === 'post-header') { this.initFixedColumnsHeader(); } else if (arguments[0] === 'scroll-body') { if (this.needFixedColumns && this.options.fixedNumber) { this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop()); } if (this.needFixedColumns && this.options.fixedRightNumber) { this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop()); } } else if (arguments[0] === 'load-success') { this.hideLoading(); } }; BootstrapTable.prototype.updateSelected = function () { var that = this; _updateSelected.apply(this, Array.prototype.slice.apply(arguments)); if (!this.fixedColumnsSupported()) { return; } this.$tableBody.find('tr').each(function (i, el) { var $el = $(el); var index = $el.data('index'); var classes = $el.attr('class'); var inputSelector = '[name="' + that.options.selectItemName + '"]'; var $input = $el.find(inputSelector); if (typeof index === 'undefined') { return; } var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) { var $tr = $fixedBody.find('tr[data-index="' + index + '"]'); $tr.attr('class', classes); if ($input.length) { $tr.find(inputSelector).prop('checked', $input.prop('checked')); } if (that.$selectAll.length) { $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked')); } }; if (that.$fixedBody && that.options.fixedNumber) { updateFixedBody(that.$fixedHeader, that.$fixedBody); } if (that.$fixedBodyRight && that.options.fixedRightNumber) { updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight); } }); }; BootstrapTable.prototype.hideLoading = function () { _hideLoading.apply(this, Array.prototype.slice.apply(arguments)); if (this.needFixedColumns && this.options.fixedNumber) { this.$fixedColumns.find('.fixed-table-loading').hide(); } if (this.needFixedColumns && this.options.fixedRightNumber) { this.$fixedColumnsRight.find('.fixed-table-loading').hide(); } }; BootstrapTable.prototype.initFixedColumnsHeader = function () { var that = this; if (this.options.height) { this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true); } else { this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true); } var initFixedHeader = function initFixedHeader($fixedColumns, isRight) { $fixedColumns.find('.fixed-table-header').remove(); $fixedColumns.append(that.$tableHeader.clone(true)); $fixedColumns.find('.fixed-table-header').css('margin-right', ""); $fixedColumns.css({ width: that.getFixedColumnsWidth(isRight) }); return $fixedColumns.find('.fixed-table-header'); }; if (this.needFixedColumns && this.options.fixedNumber) { this.$fixedHeader = initFixedHeader(this.$fixedColumns); this.$fixedHeader.css('margin-right', ''); } else if (this.$fixedColumns) { this.$fixedColumns.html('').css('width', ''); } if (this.needFixedColumns && this.options.fixedRightNumber) { this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true); this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width()); } else if (this.$fixedColumnsRight) { this.$fixedColumnsRight.html('').css('width', ''); } this.initFixedColumnsBody(); this.initFixedColumnsEvents(); }; BootstrapTable.prototype.initFixedColumnsBody = function () { var that = this; var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) { $fixedColumns.find('.fixed-table-body').remove(); $fixedColumns.append(that.$tableBody.clone(true)); var $fixedBody = $fixedColumns.find('.fixed-table-body'); var tableBody = that.$tableBody.get(0); var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0; var paginationHeight = $(".fixed-table-pagination", that.$tableContainer).height(); if (typeof that.options.height !== 'undefined') paginationHeight = 0; var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1; $fixedColumns.css({ height: height, "min-height": "calc(100% - " + (paginationHeight + scrollHeight) + "px)" }); $fixedBody.css({ height: height - $fixedHeader.height(), "min-height": "calc(100% - " + $fixedHeader.height() + "px)", overflow: "hidden" }); return $fixedBody; }; if (this.needFixedColumns && this.options.fixedNumber) { this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader); } if (this.needFixedColumns && this.options.fixedRightNumber) { this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight); this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width()); this.$fixedBodyRight.css('overflow-y', 'hidden'); } }; BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) { var visibleFields = this.getVisibleFields(); var width = 0; var fixedNumber = this.options.fixedNumber; var marginRight = 0; if (isRight) { visibleFields = visibleFields.reverse(); fixedNumber = this.options.fixedRightNumber; //右侧固定列距离 this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody)); } for (var i = 0; i < fixedNumber; i++) { width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth(); } return width + 1; }; BootstrapTable.prototype.initFixedColumnsEvents = function () { var that = this; var toggleHover = function toggleHover(e, toggle) { var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]'; var $trs = that.$tableBody.find(tr); if (that.$fixedBody) { $trs = $trs.add(that.$fixedBody.find(tr)); } if (that.$fixedBodyRight) { $trs = $trs.add(that.$fixedBodyRight.find(tr)); } $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : ''); }; this.$tableBody.find('tr').hover(function (e) { toggleHover(e, true); }, function (e) { toggleHover(e, false); }); var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1; var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel'; var updateScroll = function updateScroll(e, fixedBody) { var normalized = normalizeWheel(e); var deltaY = Math.ceil(normalized.pixelY); var top = that.$tableBody.scrollTop() + deltaY; if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) { e.preventDefault(); } that.$tableBody.scrollTop(top); if (that.$fixedBody) { that.$fixedBody.scrollTop(top); } if (that.$fixedBodyRight) { that.$fixedBodyRight.scrollTop(top); } }; if (this.needFixedColumns && this.options.fixedNumber) { this.$fixedBody.find('tr').hover(function (e) { toggleHover(e, true); }, function (e) { toggleHover(e, false); }); this.$fixedBody[0].addEventListener(mousewheel, function (e) { //给鼠标滑轮绑定事件 updateScroll(e, that.$fixedBody[0]); }); //给固定表格的checkbox绑定事件 this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) { e.stopImmediatePropagation(); var index = $(e.target).data("index"); $(that.$selectItem[index]).trigger("click"); }); //绑定TD点击事件 this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { var index = $(this).closest("tr[data-index]").data("index"); $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click"); }); } //给原本表格绑定scroll事件 $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll this.$tableBody.off('scroll').on('scroll', function (e) { that.$tableHeader.scrollLeft(0); if (that.$tableBody.scrollLeft() > 0) { that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft()); if (that.options.showFooter && !that.options.cardView) { that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft()); } } var top = that.$tableBody.scrollTop(); if (that.$fixedBody) { that.$fixedBody.scrollTop(top); } if (that.$fixedBodyRight) { that.$fixedBodyRight.scrollTop(top); } }); if (this.needFixedColumns && this.options.fixedRightNumber) { this.$fixedBodyRight.find('tr').hover(function (e) { toggleHover(e, true); }, function (e) { toggleHover(e, false); }); this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) { //给鼠标滑轮绑定事件 updateScroll(e, that.$fixedBodyRight[0]); }); //给固定表格的checkbox绑定事件 this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) { e.stopImmediatePropagation(); var index = $(e.target).data("index"); $(that.$selectItem[index]).trigger("click"); }); //绑定TD点击事件 this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { var index = $(this).closest("tr[data-index]").data("index"); $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click"); }); } if (this.options.filterControl) { $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) { var $target = $(e.target); var value = $target.val(); var field = $target.parents('th').data('field'); var $coreTh = that.$header.find('th[data-field="' + field + '"]'); if ($target.is('input')) { $coreTh.find('input').val(value); } else if ($target.is('select')) { var $select = $coreTh.find('select'); $select.find('option[selected]').removeAttr('selected'); $select.find('option[value="' + value + '"]').attr('selected', true); } that.triggerSearch(); }); } }; })(jQuery); define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) { return function () { var ret, fn; return ret || global.$.fn.bootstrapTable.defaults; }; }(this))); define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template', 'bootstrap-table-jumpto', 'bootstrap-table-fixed-columns'], function ($, undefined, Moment) { var Table = { list: {}, // Bootstrap-table 基础配置 defaults: { url: '', sidePagination: 'server', method: 'get', //请求方法 toolbar: ".toolbar", //工具栏 search: true, //是否启用快速搜索 cache: false, commonSearch: true, //是否启用通用搜索 searchFormVisible: false, //是否始终显示搜索表单 titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索 idTable: 'commonTable', showExport: true, exportDataType: "auto", exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'], exportOptions: { fileName: 'export_' + Moment().format("YYYY-MM-DD"), preventInjection: false, mso: { onMsoNumberFormat: function (cell, row, col) { return !isNaN($(cell).text()) ? '\\@' : ''; }, }, ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列 }, pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10, pageList: [10, 15, 20, 25, 50, 'All'], pagination: true, clickToSelect: true, //是否启用点击选中 dblClickToEdit: true, //是否启用双击编辑 singleSelect: false, //是否启用单选 showRefresh: false, showJumpto: true, locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US', showToggle: true, showColumns: true, pk: 'id', sortName: 'id', sortOrder: 'desc', paginationFirstText: __("First"), paginationPreText: __("Previous"), paginationNextText: __("Next"), paginationLastText: __("Last"), cardView: false, //卡片视图 iosCardView: true, //ios卡片视图 checkOnInit: true, //是否在初始化时判断 escape: true, //是否对内容进行转义 fixDropdownPosition: true, //是否修复下拉的定位 selectedIds: [], selectedData: [], extend: { index_url: '', add_url: '', edit_url: '', del_url: '', import_url: '', multi_url: '', dragsort_url: 'ajax/weigh', } }, // Bootstrap-table 列配置 columnDefaults: { align: 'center', valign: 'middle', }, config: { checkboxtd: 'tbody>tr>td.bs-checkbox', toolbar: '.toolbar', refreshbtn: '.btn-refresh', addbtn: '.btn-add', editbtn: '.btn-edit', delbtn: '.btn-del', importbtn: '.btn-import', multibtn: '.btn-multi', disabledbtn: '.btn-disabled', editonebtn: '.btn-editone', restoreonebtn: '.btn-restoreone', destroyonebtn: '.btn-destroyone', restoreallbtn: '.btn-restoreall', destroyallbtn: '.btn-destroyall', dragsortfield: 'weigh', }, button: { edit: { name: 'edit', icon: 'fa fa-pencil', title: __('Edit'), extend: 'data-toggle="tooltip"', classname: 'btn btn-xs btn-success btn-editone' }, del: { name: 'del', icon: 'fa fa-trash', title: __('Del'), extend: 'data-toggle="tooltip"', classname: 'btn btn-xs btn-danger btn-delone' }, dragsort: { name: 'dragsort', icon: 'fa fa-arrows', title: __('Drag to sort'), extend: 'data-toggle="tooltip"', classname: 'btn btn-xs btn-primary btn-dragsort' } }, api: { init: function (defaults, columnDefaults, locales) { defaults = defaults ? defaults : {}; columnDefaults = columnDefaults ? columnDefaults : {}; locales = locales ? locales : {}; $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () { return this.$selectItem; }; var _onPageListChange = $.fn.bootstrapTable.Constructor.prototype.onPageListChange; $.fn.bootstrapTable.Constructor.prototype.onPageListChange = function () { _onPageListChange.apply(this, Array.prototype.slice.apply(arguments)); localStorage.setItem('pagesize', this.options.pageSize); return false; }; // 写入bootstrap-table默认配置 $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults); // 写入bootstrap-table column配置 $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults); // 写入bootstrap-table locale配置 $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], { formatCommonSearch: function () { return __('Common search'); }, formatCommonSubmitButton: function () { return __('Submit'); }, formatCommonResetButton: function () { return __('Reset'); }, formatCommonCloseButton: function () { return __('Close'); }, formatCommonChoose: function () { return __('Choose'); }, formatJumpto: function () { return __('Go'); } }, locales); // 如果是iOS设备则判断是否启用卡片视图 if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { Table.defaults.cardView = true; $.fn.bootstrapTable.defaults.cardView = true; } if (typeof defaults.exportTypes != 'undefined') { $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes; } }, // 绑定事件 bindevent: function (table) { //Bootstrap-table的父元素,包含table,toolbar,pagnation var parenttable = table.closest('.bootstrap-table'); //Bootstrap-table配置 var options = table.bootstrapTable('getOptions'); //Bootstrap操作区 var toolbar = $(options.toolbar, parenttable); //跨页提示按钮 var tipsBtn = $(".btn-selected-tips", parenttable); if (tipsBtn.length === 0) { tipsBtn = $(' ' + __("Multiple selection mode: %s checked", "0") + '').appendTo(toolbar); } //点击提示按钮 tipsBtn.off("click").on("click", function (e) { table.trigger("uncheckbox"); table.bootstrapTable("refresh"); }); //当刷新表格时 table.on('uncheckbox', function (status, res, e) { options.selectedIds = []; options.selectedData = []; tipsBtn.tooltip('hide'); tipsBtn.addClass('hide'); }); //表格加载出错时 table.on('load-error.bs.table', function (status, res, e) { if (e.status === 0) { return; } Toastr.error(__('Unknown data format')); }); //当加载数据成功时 table.on('load-success.bs.table', function (e, data) { if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') { Toastr.error(data.msg); } }); //当刷新表格时 table.on('refresh.bs.table', function (e, settings, data) { $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin"); }); //当执行搜索时 table.on('search.bs.table common-search.bs.table', function (e, settings, data) { table.trigger("uncheckbox"); }); if (options.dblClickToEdit) { //当双击单元格时 table.on('dbl-click-row.bs.table', function (e, row, element, field) { $(Table.config.editonebtn, element).trigger("click"); }); } //渲染内容前 table.on('pre-body.bs.table', function (e, data) { if (options.maintainSelected) { $.each(data, function (i, row) { row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1; }); } }); //当内容渲染完成后 table.on('post-body.bs.table', function (e, data) { $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").length > 0) { // 拖拽选择,需要重新绑定事件 require(['drag', 'drop'], function () { var checkboxtd = $(Table.config.checkboxtd, table); checkboxtd.drag("start", function (ev, dd) { return $('
    ').css('opacity', .65).appendTo(document.body); }).drag(function (ev, dd) { $(dd.proxy).css({ top: Math.min(ev.pageY, dd.startY), left: Math.min(ev.pageX, dd.startX), height: Math.abs(ev.pageY - dd.startY), width: Math.abs(ev.pageX - dd.startX) }); }).drag("end", function (ev, dd) { $(dd.proxy).remove(); }); checkboxtd.drop("start", function () { Table.api.toggleattr(this); }).drop(function () { // Table.api.toggleattr(this); }).drop("end", function (e) { var that = this; setTimeout(function () { if (e.type === 'mousemove') { Table.api.toggleattr(that); } }, 0); }); $.drop({ multi: true }); }); } }); var exportDataType = options.exportDataType; // 处理选中筛选框后按钮的状态统一变更 table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) { var allIds = []; $.each(table.bootstrapTable("getData"), function (i, item) { allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : ''); }); var selectedIds = Table.api.selectedids(table, true), selectedData = Table.api.selecteddata(table, true); //开启分页checkbox分页记忆 if (options.maintainSelected) { options.selectedIds = options.selectedIds.filter(function (element, index, self) { return $.inArray(element, allIds) === -1; }).concat(selectedIds); options.selectedData = options.selectedData.filter(function (element, index, self) { return $.inArray(element[options.pk], allIds) === -1; }).concat(selectedData); if (options.selectedIds.length > selectedIds.length) { $("b", tipsBtn).text(options.selectedIds.length); tipsBtn.removeClass('hide'); } else { tipsBtn.addClass('hide'); } } else { options.selectedIds = selectedIds; options.selectedData = selectedData; } //如果导出类型为auto时则自动判断 if (exportDataType === 'auto') { options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all'; } $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length); }); // 绑定TAB事件 $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { var field = $(this).closest("[data-field]").data("field"); var value = $(this).data("value"); var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table")); if (object.prop('tagName') == "SELECT") { $("option[value='" + value + "']", object).prop("selected", true); } else { object.val(value); } table.trigger("uncheckbox"); table.bootstrapTable('refresh', {pageNumber: 1}); return false; }); // 修复重置事件 $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () { setTimeout(function () { // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab'); }, 0); $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active'); $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active'); }); // 刷新按钮事件 toolbar.on('click', Table.config.refreshbtn, function () { table.bootstrapTable('refresh'); }); // 添加按钮事件 toolbar.on('click', Table.config.addbtn, function () { var ids = Table.api.selectedids(table); var url = options.extend.add_url; if (url.indexOf("{ids}") !== -1) { url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table); } Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {}); }); // 导入按钮事件 if ($(Table.config.importbtn, toolbar).length > 0) { require(['upload'], function (Upload) { Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) { Fast.api.ajax({ url: options.extend.import_url, data: {file: data.url}, }, function (data, ret) { table.trigger("uncheckbox"); table.bootstrapTable('refresh'); }); }); }); } // 批量编辑按钮事件 toolbar.on('click', Table.config.editbtn, function () { var that = this; var ids = Table.api.selectedids(table); if (ids.length > 10) { return; } var title = $(that).data('title') || $(that).attr("title") || __('Edit'); var data = $(that).data() || {}; delete data.title; //循环弹出多个编辑框 $.each(Table.api.selecteddata(table), function (index, row) { var url = options.extend.edit_url; row = $.extend({}, row ? row : {}, {ids: row[options.pk]}); url = Table.api.replaceurl(url, row, table); Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data); }); }); //清空回收站 $(document).on('click', Table.config.destroyallbtn, function () { var that = this; Layer.confirm(__('Are you sure you want to truncate?'), function () { var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href"); Fast.api.ajax(url, function () { Layer.closeAll(); table.trigger("uncheckbox"); table.bootstrapTable('refresh'); }, function () { Layer.closeAll(); }); }); return false; }); //全部还原 $(document).on('click', Table.config.restoreallbtn, function () { var that = this; var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href"); Fast.api.ajax(url, function () { Layer.closeAll(); table.trigger("uncheckbox"); table.bootstrapTable('refresh'); }, function () { Layer.closeAll(); }); return false; }); //销毁或删除 $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () { var that = this; var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href"); var row = Fast.api.getrowbyindex(table, $(that).data("row-index")); Fast.api.ajax({ url: url, data: {ids: row[options.pk]} }, function () { table.trigger("uncheckbox"); table.bootstrapTable('refresh'); }); return false; }); // 批量操作按钮事件 toolbar.on('click', Table.config.multibtn, function () { var ids = Table.api.selectedids(table); Table.api.multi($(this).data("action"), ids, table, this); }); // 批量删除按钮事件 toolbar.on('click', Table.config.delbtn, function () { var that = this; var ids = Table.api.selectedids(table); Layer.confirm( __('Are you sure you want to delete the %s selected item?', ids.length), {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]}, function (index) { Table.api.multi("del", ids, table, that); Layer.close(index); } ); }); // 拖拽排序 require(['dragsort'], function () { //绑定拖动排序 $("tbody", table).dragsort({ itemSelector: 'tr:visible', dragSelector: "a.btn-dragsort", dragEnd: function (a, b) { var element = $("a.btn-dragsort", this); var data = table.bootstrapTable('getData'); var current = data[parseInt($(this).data("index"))]; var options = table.bootstrapTable('getOptions'); //改变的值和改变的ID集合 var ids = $.map($("tbody tr:visible", table), function (tr) { return data[parseInt($(tr).data("index"))][options.pk]; }); var changeid = current[options.pk]; var pid = typeof current.pid != 'undefined' ? current.pid : ''; var params = { url: table.bootstrapTable('getOptions').extend.dragsort_url, data: { ids: ids.join(','), changeid: changeid, pid: pid, field: Table.config.dragsortfield, orderway: options.sortOrder, table: options.extend.table, pk: options.pk } }; Fast.api.ajax(params, function (data, ret) { var success = $(element).data("success") || $.noop; if (typeof success === 'function') { if (false === success.call(element, data, ret)) { return false; } } table.bootstrapTable('refresh'); }, function (data, ret) { var error = $(element).data("error") || $.noop; if (typeof error === 'function') { if (false === error.call(element, data, ret)) { return false; } } table.bootstrapTable('refresh'); }); }, placeHolderTemplate: "" }); }); table.on("click", "input[data-id][name='checkbox']", function (e) { var ids = $(this).data("id"); table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]}); }); table.on("click", "[data-id].btn-change", function (e) { e.preventDefault(); var changer = $.proxy(function () { Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this); }, this); if (typeof $(this).data("confirm") !== 'undefined') { Layer.confirm($(this).data("confirm"), function (index) { changer(); Layer.close(index); }); } else { changer(); } }); table.on("click", "[data-id].btn-edit", function (e) { e.preventDefault(); var ids = $(this).data("id"); var row = Table.api.getrowbyid(table, ids); row.ids = ids; var url = Table.api.replaceurl(options.extend.edit_url, row, table); Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {}); }); table.on("click", "[data-id].btn-del", function (e) { e.preventDefault(); var id = $(this).data("id"); var that = this; Layer.confirm( __('Are you sure you want to delete this item?'), {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]}, function (index) { Table.api.multi("del", id, table, that); Layer.close(index); } ); }); //修复dropdown定位溢出的情况 if (options.fixDropdownPosition) { var tableBody = table.closest(".fixed-table-body"); table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) { var dropdownMenu = $(".dropdown-menu", this); var btnGroup = $(this); var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right"); var left, top, position; if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) { position = 'fixed'; top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight(); if ((top + dropdownMenu.outerHeight()) > $(window).height()) { top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5; } left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left; } if (left || top) { dropdownMenu.css({ position: position, left: left, top: top, right: 'inherit' }); } }); var checkdropdown = function () { if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') { $(".btn-group.open", table).trigger("fa.event.refreshdropdown"); } }; $(window).on("scroll", function () { checkdropdown(); }); tableBody.on("scroll", function () { checkdropdown(); }); } var id = table.attr("id"); Table.list[id] = table; return table; }, // 批量操作请求 multi: function (action, ids, table, element) { var options = table.bootstrapTable('getOptions'); var data = element ? $(element).data() : {}; ids = ($.isArray(ids) ? ids.join(",") : ids); var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url); var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : ''; options = {url: url, data: {action: action, ids: ids, params: params}}; Fast.api.ajax(options, function (data, ret) { table.trigger("uncheckbox"); var success = $(element).data("success") || $.noop; if (typeof success === 'function') { if (false === success.call(element, data, ret)) { return false; } } table.bootstrapTable('refresh'); }, function (data, ret) { var error = $(element).data("error") || $.noop; if (typeof error === 'function') { if (false === error.call(element, data, ret)) { return false; } } }); }, // 单元格元素事件 events: { operate: { 'click .btn-editone': function (e, value, row, index) { e.stopPropagation(); e.preventDefault(); var table = $(this).closest('table'); var options = table.bootstrapTable('getOptions'); var ids = row[options.pk]; row = $.extend({}, row ? row : {}, {ids: ids}); var url = options.extend.edit_url; Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {}); }, 'click .btn-delone': function (e, value, row, index) { e.stopPropagation(); e.preventDefault(); var that = this; var top = $(that).offset().top - $(window).scrollTop(); var left = $(that).offset().left - $(window).scrollLeft() - 260; if (top + 154 > $(window).height()) { top = top - 154; } if ($(window).width() < 480) { top = left = undefined; } Layer.confirm( __('Are you sure you want to delete this item?'), {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]}, function (index) { var table = $(that).closest('table'); var options = table.bootstrapTable('getOptions'); Table.api.multi("del", row[options.pk], table, that); Layer.close(index); } ); } },//单元格图片预览 image: { 'click .img-center': function (e, value, row, index) { var data = []; value = value === null ? '' : value.toString(); var arr = value != '' ? value.split(",") : []; var url; $.each(arr, function (index, value) { url = Fast.api.cdnurl(value); data.push({ src: url, thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle }); }); Layer.photos({ photos: { "start": $(this).parent().index(), "data": data }, anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) }); }, } }, // 单元格数据格式化 formatter: { icon: function (value, row, index) { value = value === null ? '' : value.toString(); value = value.indexOf(" ") > -1 ? value : "fa fa-" + value; //渲染fontawesome图标 return ' ' + value; }, image: function (value, row, index) { value = value == null || value.length === 0 ? '' : value.toString(); value = value ? value : '/assets/img/blank.gif'; var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center'; var url = Fast.api.cdnurl(value, true); url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle; return ''; }, images: function (value, row, index) { value = value == null || value.length === 0 ? '' : value.toString(); var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center'; var arr = value != '' ? value.split(',') : []; var html = []; var url; $.each(arr, function (i, value) { value = value ? value : '/assets/img/blank.gif'; url = Fast.api.cdnurl(value, true); url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle; html.push(''); }); return html.join(' '); }, file: function (value, row, index) { value = value == null || value.length === 0 ? '' : value.toString(); value = Fast.api.cdnurl(value, true); var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center'; var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value); suffix = suffix ? suffix[1] : 'file'; var url = Fast.api.fixurl("ajax/icon?suffix=" + suffix); return ''; }, files: function (value, row, index) { value = value == null || value.length === 0 ? '' : value.toString(); var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center'; var arr = value != '' ? value.split(',') : []; var html = []; var suffix, url; $.each(arr, function (i, value) { value = Fast.api.cdnurl(value, true); suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value); suffix = suffix ? suffix[1] : 'file'; url = Fast.api.fixurl("ajax/icon?suffix=" + suffix); html.push(''); }); return html.join(' '); }, content: function (value, row, index) { var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px"; return "
    " + value + "
    "; }, status: function (value, row, index) { var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'}; if (typeof this.custom !== 'undefined') { custom = $.extend(custom, this.custom); } this.custom = custom; this.icon = 'fa fa-circle'; return Table.api.formatter.normal.call(this, value, row, index); }, normal: function (value, row, index) { var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"]; var custom = {}; if (typeof this.custom !== 'undefined') { custom = $.extend(custom, this.custom); } value = value == null || value.length === 0 ? '' : value.toString(); var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : []; var index = keys.indexOf(value); var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null; var display = index > -1 ? this.searchList[value] : null; var icon = typeof this.icon !== 'undefined' ? this.icon : null; if (!color) { color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary'; } if (!display) { display = __(value.charAt(0).toUpperCase() + value.slice(1)); } var html = '' + (icon ? ' ' : '') + display + ''; if (this.operate != false) { html = '' + html + ''; } return html; }, toggle: function (value, row, index) { var table = this.table; var options = table ? table.bootstrapTable('getOptions') : {}; var pk = options.pk || "id"; var color = typeof this.color !== 'undefined' ? this.color : 'success'; var yes = typeof this.yes !== 'undefined' ? this.yes : 1; var no = typeof this.no !== 'undefined' ? this.no : 0; var url = typeof this.url !== 'undefined' ? this.url : ''; var confirm = ''; var disable = false; if (typeof this.confirm !== "undefined") { confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm; } if (typeof this.disable !== "undefined") { disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable; } return ""; }, url: function (value, row, index) { value = value == null || value.length === 0 ? '' : value.toString(); return '
    '; }, search: function (value, row, index) { var field = this.field; if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') { value = row[this.customField]; field = this.customField; } return '' + value + ''; }, addtabs: function (value, row, index) { var url = Table.api.replaceurl(this.url || '', row, this.table); var title = this.atitle ? this.atitle : __("Search %s", value); return '' + value + ''; }, dialog: function (value, row, index) { var url = Table.api.replaceurl(this.url || '', row, this.table); var title = this.atitle ? this.atitle : __("View %s", value); return '' + value + ''; }, flag: function (value, row, index) { var that = this; value = value == null || value.length === 0 ? '' : value.toString(); var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'}; //如果字段列有定义custom if (typeof this.custom !== 'undefined') { colorArr = $.extend(colorArr, this.custom); } var field = this.field; if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') { value = row[this.customField]; field = this.customField; } if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') { var i = 0; var searchValues = Object.values(colorArr); $.each(that.searchList, function (key, val) { if (typeof colorArr[key] == 'undefined') { colorArr[key] = searchValues[i]; i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1; } }); } //渲染Flag var html = []; var arr = value != '' ? value.split(',') : []; var color, display, label; $.each(arr, function (i, value) { value = value == null || value.length === 0 ? '' : value.toString(); if (value == '') return true; color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary'; display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1)); label = '' + display + ''; if (that.operate) { html.push('' + label + ''); } else { html.push(label); } }); return html.join(' '); }, label: function (value, row, index) { return Table.api.formatter.flag.call(this, value, row, index); }, datetime: function (value, row, index) { var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat; if (isNaN(value)) { return value ? Moment(value).format(datetimeFormat) : __('None'); } else { return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None'); } }, operate: function (value, row, index) { var table = this.table; // 操作配置 var options = table ? table.bootstrapTable('getOptions') : {}; // 默认按钮组 var buttons = $.extend([], this.buttons || []); // 所有按钮名称 var names = []; buttons.forEach(function (item) { names.push(item.name); }); if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) { buttons.push(Table.button.dragsort); } if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) { Table.button.edit.url = options.extend.edit_url; buttons.push(Table.button.edit); } if (options.extend.del_url !== '' && names.indexOf('del') === -1) { buttons.push(Table.button.del); } return Table.api.buttonlink(this, buttons, value, row, index, 'operate'); } , buttons: function (value, row, index) { // 默认按钮组 var buttons = $.extend([], this.buttons || []); return Table.api.buttonlink(this, buttons, value, row, index, 'buttons'); } }, buttonlink: function (column, buttons, value, row, index, type) { var table = column.table; column.clickToSelect = false; type = typeof type === 'undefined' ? 'buttons' : type; var options = table ? table.bootstrapTable('getOptions') : {}; var html = []; var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend, dropdown, link; var fieldIndex = column.fieldIndex; var dropdowns = {}; $.each(buttons, function (i, j) { if (type === 'operate') { if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') { return true; } if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) { return true; } } var attr = table.data(type + "-" + j.name); if (typeof attr === 'undefined' || attr) { hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false); if (hidden) { return true; } visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true); if (!visible) { return true; } dropdown = j.dropdown ? j.dropdown : ''; url = j.url ? j.url : ''; url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;'); classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one'); icon = j.icon ? j.icon : ''; text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : ''; title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text; refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : ''; confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false); confirm = confirm ? 'data-confirm="' + confirm + '"' : ''; extend = j.extend ? j.extend : ''; disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false); if (disable) { classname = classname + ' disabled'; } link = '' + (text ? ' ' + text : '') + ''; if (dropdown) { if (typeof dropdowns[dropdown] == 'undefined') { dropdowns[dropdown] = []; } dropdowns[dropdown].push(link); } else { html.push(link); } } }); if (!$.isEmptyObject(dropdowns)) { var dropdownHtml = []; $.each(dropdowns, function (i, j) { dropdownHtml.push('
    '); }); html.unshift(dropdownHtml); } return html.join(' '); }, //替换URL中的数据 replaceurl: function (url, row, table) { var options = table ? table.bootstrapTable('getOptions') : null; var ids = options ? row[options.pk] : 0; row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0); url = url == null || url.length === 0 ? '' : url.toString(); //自动添加ids参数 url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url; url = url.replace(/\{(.*?)\}/gi, function (matched) { matched = matched.substring(1, matched.length - 1); if (matched.indexOf(".") !== -1) { var temp = row; var arr = matched.split(/\./); for (var i = 0; i < arr.length; i++) { if (typeof temp[arr[i]] !== 'undefined') { temp = temp[arr[i]]; } } return typeof temp === 'object' ? '' : temp; } return row[matched]; }); return url; }, // 获取选中的条目ID集合 selectedids: function (table, current) { var options = table.bootstrapTable('getOptions'); //如果有设置翻页记忆模式 if (!current && options.maintainSelected) { return options.selectedIds; } return $.map(table.bootstrapTable('getSelections'), function (row) { return row[options.pk]; }); }, //获取选中的数据 selecteddata: function (table, current) { var options = table.bootstrapTable('getOptions'); //如果有设置翻页记忆模式 if (!current && options.maintainSelected) { return options.selectedData; } return table.bootstrapTable('getSelections'); }, // 切换复选框状态 toggleattr: function (table) { $("input[type='checkbox']", table).trigger('click'); }, // 根据行索引获取行数据 getrowdata: function (table, index) { index = parseInt(index); var data = table.bootstrapTable('getData'); return typeof data[index] !== 'undefined' ? data[index] : null; }, // 根据行索引获取行数据 getrowbyindex: function (table, index) { return Table.api.getrowdata(table, index); }, // 根据主键ID获取行数据 getrowbyid: function (table, id) { var row = {}; var options = table.bootstrapTable("getOptions"); $.each(Table.api.selecteddata(table), function (i, j) { if (j[options.pk] == id) { row = j; return false; } }); return row; } }, }; return Table; }); // jQuery List DragSort v0.5.2 // Website: http://dragsort.codeplex.com/ // License: http://dragsort.codeplex.com/license (function($) { $.fn.dragsort = function(options) { if (options == "destroy") { $(this.selector).trigger("dragsort-uninit"); return; } var opts = $.extend({}, $.fn.dragsort.defaults, options); var lists = []; var list = null, lastPos = null; this.each(function(i, cont) { //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody")) cont = $(cont).children().get(0); var newList = { draggedItem: null, placeHolderItem: null, pos: null, offset: null, offsetLimit: null, scroll: null, container: cont, init: function() { //set options to default values if not set opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName; if (opts.itemSelector == "") opts.itemSelector = opts.tagName; if (opts.dragSelector == "") opts.dragSelector = opts.tagName; if (opts.placeHolderTemplate == "") opts.placeHolderTemplate = "<" + opts.tagName + "> "; //listidx allows reference back to correct list variable instance $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); this.styleDragHandlers(true); }, uninit: function() { var list = lists[$(this).attr("data-listidx")]; $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); list.styleDragHandlers(false); }, getItems: function() { return $(this.container).children(opts.itemSelector); }, styleDragHandlers: function(cursor) { this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : ""); }, grabItem: function(e) { var list = lists[$(this).attr("data-listidx")]; var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0; //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem) return; //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved, //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude //e.preventDefault(); //change cursor to move while dragging var dragHandle = e.target; while (!$(dragHandle).is(opts.dragSelector)) { if (dragHandle == this) return; dragHandle = dragHandle.parentNode; } $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); $(dragHandle).css("cursor", "move"); //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work var listElem = this; var trigger = function() { list.dragStart.call(listElem, e); $(list.container).unbind("mousemove", trigger); }; $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); }, dragStart: function(e) { if (list != null && list.draggedItem != null) list.dropItem(); list = lists[$(this).attr("data-listidx")]; list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); //calculate mouse offset relative to draggedItem var mt = parseInt(list.draggedItem.css("marginTop")); var ml = parseInt(list.draggedItem.css("marginLeft")); list.offset = list.draggedItem.offset(); list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; //calculate box the dragged item can't be dragged outside of if (!opts.dragBetween) { var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); list.offsetLimit = $(list.container).offset(); list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); } //create placeholder item var h = list.draggedItem.height(); var w = list.draggedItem.width(); if (opts.tagName == "tr") { list.draggedItem.children().each(function() { $(this).width($(this).width()); }); list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true); list.draggedItem.after(list.placeHolderItem); //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); list.placeHolderItem.children().each(function() { $(this).html(" "); }); } else { list.draggedItem.after(opts.placeHolderTemplate); list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true); } if (opts.tagName == "td") { var listTable = list.draggedItem.closest("table").get(0); $("
    ").appendTo("body").children().append(list.draggedItem); } //style draggedItem while dragging var orig = list.draggedItem.attr("style"); list.draggedItem.attr("data-origstyle", orig ? orig : ""); list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w }); //auto-scroll setup list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; list.scroll.scrollY = window.setInterval(function() { if (opts.scrollContainer != window) { $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); return; } var t = $(opts.scrollContainer).scrollTop(); if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); } }, 10); list.scroll.scrollX = window.setInterval(function() { if (opts.scrollContainer != window) { $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); return; } var l = $(opts.scrollContainer).scrollLeft(); if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); } }, 10); //misc $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); list.setPos(e.pageX, e.pageY); $(document).bind("mousemove", list.swapItems); $(document).bind("mouseup", list.dropItem); if (opts.scrollContainer != window) $(window).bind("wheel", list.wheel); }, //set position of draggedItem setPos: function(x, y) { //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner var top = y - this.offset.top; var left = x - this.offset.left; //limit top, left to within box draggedItem can't be dragged outside of if (!opts.dragBetween) { top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); } //adjust top & left calculations to parent offset var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin if (parent != null) { top -= parent.top; left -= parent.left; } //set x or y auto-scroll amount if (opts.scrollContainer == window) { y -= $(window).scrollTop(); x -= $(window).scrollLeft(); y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); } else { var cont = $(opts.scrollContainer); var offset = cont.offset(); y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); } list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); //move draggedItem to new mouse cursor location this.draggedItem.css({ top: top, left: left }); }, //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over wheel: function(e) { if (list && opts.scrollContainer != window) { var cont = $(opts.scrollContainer); var offset = cont.offset(); e = e.originalEvent; if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; cont.scrollTop(cont.scrollTop() + deltaY); e.preventDefault(); } } }, //build a table recording all the positions of the moveable list items buildPositionTable: function() { var pos = []; this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { var loc = $(this).offset(); loc.right = loc.left + $(this).outerWidth(); loc.bottom = loc.top + $(this).outerHeight(); loc.elm = this; pos[i] = loc; }); this.pos = pos; }, dropItem: function() { if (list.draggedItem == null) return; //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower) var orig = list.draggedItem.attr("data-origstyle"); list.draggedItem.attr("style", orig); if (orig == "") list.draggedItem.removeAttr("style"); list.draggedItem.removeAttr("data-origstyle"); list.styleDragHandlers(true); list.placeHolderItem.before(list.draggedItem); list.placeHolderItem.remove(); $("[data-droptarget], .dragSortItem").remove(); window.clearInterval(list.scroll.scrollY); window.clearInterval(list.scroll.scrollX); //if position changed call dragEnd if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order var pos = list.draggedItem.attr("data-origpos").split('-'); var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); if (nextItem.size() > 0) nextItem.before(list.draggedItem); else if (pos[1] == 0) //was the only item in list $(lists[pos[0]].container).prepend(list.draggedItem); else //was the last item in list $(lists[pos[0]].container).append(list.draggedItem); } list.draggedItem.removeAttr("data-origpos"); list.draggedItem = null; $(document).unbind("mousemove", list.swapItems); $(document).unbind("mouseup", list.dropItem); if (opts.scrollContainer != window) $(window).unbind("wheel", list.wheel); return false; }, //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of swapItems: function(e) { if (list.draggedItem == null) return false; //move draggedItem to mouse location list.setPos(e.pageX, e.pageY); //retrieve list and item position mouse cursor is over var ei = list.findPos(e.pageX, e.pageY); var nlist = list; for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { ei = lists[i].findPos(e.pageX, e.pageY); nlist = lists[i]; } //if not over another moveable list item return if (ei == -1) return false; //save fixed items locations var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) $(nlist.pos[ei].elm).before(list.placeHolderItem); else $(nlist.pos[ei].elm).after(list.placeHolderItem); //restore fixed items location fixed.each(function() { var elm = children().eq(this.idx).get(0); if (this != elm && children().index(this) < this.idx) $(this).insertAfter(elm); else if (this != elm) $(this).insertBefore(elm); }); //misc $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); lastPos = list.draggedItem.offset(); return false; }, //returns the index of the list item the mouse is over findPos: function(x, y) { for (var i = 0; i < this.pos.length; i++) { if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) return i; } return -1; }, //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position createDropTargets: function() { if (!opts.dragBetween) return; $(lists).each(function() { var ph = $(this.container).find("[data-placeholder]"); var dt = $(this.container).find("[data-droptarget]"); if (ph.size() > 0 && dt.size() > 0) dt.remove(); else if (ph.size() == 0 && dt.size() == 0) { if (opts.tagName == "td") $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); else //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8) $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true)); list.placeHolderItem.attr("data-placeholder", true); } }); } }; newList.init(); lists.push(newList); }); return this; }; $.fn.dragsort.defaults = { tagName:"", itemSelector: "", dragSelector: "", dragSelectorExclude: "input, textarea", dragEnd: function() { }, dragBetween: false, placeHolderTemplate: "", scrollContainer: window, scrollSpeed: 5 }; })(jQuery); define("dragsort", function(){}); /*! * jquery.event.drag - v 2.2 * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com * Open Source MIT License - http://threedubmedia.com/code/license */ ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery); define("drag", function(){}); /*! * jquery.event.drop - v 2.2 * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com * Open Source MIT License - http://threedubmedia.com/code/license */ ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k